CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2002
    Posts
    24

    Question #import "MSVBVM60.DLL" error

    I only have one statement "#import "MSVBVM60.DLL" no_namespace" in my VC6. 0 code. when I compile it, I got error message:

    d:\sampl\debug\msvbvm60.tlh(577) : error C2059: syntax error : '('

    If I add include file<afxwin.h>

    I will have additional error message:
    d:\sample\debug\msvbvm60.tlh(451) : error C2059: syntax error : '('

    why it has error in msvbvm60.tlh?

    Anyone know the reason for this error?

    Thanks.

  2. #2
    Join Date
    Jun 2002
    Posts
    48
    Hi,

    the syntax error occurs in the tlh-file at the function declaration
    VARIANT_BOOL __stdcall EOF(
    short FileNumber );

    Well, EOF is a #define in one or more standard C include files - the most important is stdio.h where it is defined as #define EOF (-1)

    My first thought was to ommit the no_namespace-attribute but it doesn't work. But I have two other solutions:

    1. Use the rename-attribute - for example:
    #import "MSVBVM60.DLL" rename("EOF","VBAEOF") rename("RGB","VBARGB")

    or

    2. undefine the EOF/RGB constant before the import and define it again after the import statement:
    #undef EOF
    #import ...
    #define EOF (-1)

    I definitively suggest option 1.

    Helmut

  3. #3
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588
    I agree, option 1 is definitely better.

  4. #4
    Join Date
    Aug 2002
    Posts
    24
    Thanks, Helmut Danzl.

  5. #5
    Join Date
    Apr 2013
    Posts
    6

    Re: #import "MSVBVM60.DLL" error

    u want send me complete sample?

  6. #6
    Join Date
    Jan 2002
    Location
    Houston, TX
    Posts
    1,421

    Re: #import "MSVBVM60.DLL" error

    After 11 years, there's a chance he's not even around this forum anymore!
    Be sure to rate those who help!
    -------------------------------------------------------------
    Karl - WK5M
    PP-ASEL-IA (N43CS)
    PGP Key: 0xDB02E193
    PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

  7. #7
    Join Date
    Apr 2013
    Posts
    6

    Re: #import "MSVBVM60.DLL" error

    u have this code!

    #include "stdafx.h"
    #include <stdlib.h>
    #include "windows.h"
    #import "MSVBVM60.DLL" raw_interfaces_only no_implementation named_guids rename_namespace ("vb6") rename ("EOF", "vbEOF") rename ("RGB", "vbRGB") rename ("GetObject", "vbGetObject")

    using namespace vb6;

    int _tmain(int argc, _TCHAR* argv[])
    {
    VARIANT v565;
    v565.intVal=2;
    float v533;

    *(float *)&v533 = Rnd(&v565);

    return 0;

    }

    when build (vstudio 2012) ...this errors:

    Error 2 error LNK1120: 1 unresolved externals

    Error 1 error LNK2019: unresolved external symbol "float __stdcall vb6::Rnd(struct tagVARIANT *)" (?Rnd@vb6@@YGMPAUtagVARIANT@@@Z) referenced in function _wmain



    Can helpme?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured