C++ VC6 to VC.NET - strange error

This is a discussion on C++ VC6 to VC.NET - strange error within the C++ Programming forums, part of the General Programming Boards category; Hi, Using my C++ VS6.0 application, I have converten a .dsw workspace file to .sln by opening it with VS.NET ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    11

    Question C++ VC6 to VC.NET - strange error

    Hi,

    Using my C++ VS6.0 application, I have converten a .dsw workspace file to .sln by opening it with VS.NET 2003 (and also tested with VS.NET 2002).

    I cleaned some syntax incompability errors, and now I am left with these 2 errors:


    Code:
    f:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\Guiddef.h(193) : error C2803: 'operator ==' 
    must have at least one formal parameter of class type
    f:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\Guiddef.h(198) : error C2803: 'operator !=' 
    must have at least one formal parameter of class type
    The code at the referred location is like this:

    Code:
    #ifdef __cplusplus
    __inline int operator==(REFGUID guidOne, REFGUID guidOther)
    {
        return IsEqualGUID(guidOne,guidOther);
    }
    
    __inline int operator!=(REFGUID guidOne, REFGUID guidOther)
    {
        return !(guidOne == guidOther);
    }
    #endif
    I have searched the net, but seams like no-one has had this error before.

    Anybody got a suggestion?

    Thanks!


    BTW: I am using several lib and dll files built with VS6.0, and since the .sln file that I am using is converted from a .dsw-file, my project is umnamaged, I guess.

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    The error points to Guiddef.h. What exactly is the error corresponding to?

    Kuphryn

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    11
    Hi Kuphryn,

    I am not sure what the error corresponds to, this is the entire build output:

    Code:
    ------ Rebuild All started: Project: applikasjon, Configuration: Debug Win32 ------
    
    Deleting intermediate files and output files for project 'applikasjon', configuration 'Debug|Win32'.
    Compiling...
    StdAfx.cpp
    mfc_fix.cpp
    CVideo.cpp
    CartVRML.cpp
    CartReference.cpp
    CartReach.cpp
    CartPose.cpp
    CartPointNode.cpp
    CartPen.cpp
     WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
    CartPathNode.cpp
    CartPathList.cpp
    CartMenuTable.cpp
    CartMenuPanel.cpp
    CartMenuButton.cpp
    CartMenu.cpp
    CartIMenu.cpp
    CartGLDisplay.cpp
    CartFont3D.cpp
    CartEventNode.cpp
    CartDisplay.cpp
    CartDetect.cpp
    f:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\Guiddef.h(193) : error C2803: 'operator ==' must have at least one formal parameter of class type
    f:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\Guiddef.h(198) : error C2803: 'operator !=' must have at least one formal parameter of class type
    CartDesign.cpp
    CartControl.cpp
    CartConfig.cpp
    CartCfgMap.cpp
    CartCameraPTGREY.cpp
    CartCameraIMAQ.cpp
    CartCamera.cpp
    CartCalMap.cpp
    C_matrix.cpp
    C_draw.cpp
    artMain.cpp
    
    Build log was saved at "file://f:\Projects\applikasjon\Debug\BuildLog.htm"
    artVIS - 2 error(s), 0 warning(s)
    
    
    ---------------------- Done ----------------------
    
        Rebuild All: 0 succeeded, 1 failed, 0 skipped
    I guess maybe the error " WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)" might have something to do with this? I am running Windows XP, however.

    Thanks!

  4. #4
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Post the code that uses that particular operator.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    11
    I'm sorry, I might be stupid, but is it the "==" operator you are talking about?

    I use == and != all over the place. The CartDetect.pp file is a few thousand lines long, and I can't post it because it is my company that owns the file...

    Guess you can't help me then....?

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Try and find a snippet of code that compares a REFGUID to another REFGUID using the '==' operator. That's all I can think of right now. We'll solve this, don't worry.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  7. #7
    Registered User
    Join Date
    Oct 2002
    Posts
    11
    Thanks bennyandthejets,

    I contacted National Instruments - they deliver a computer vision library (IMAQ) that is used in the application.

    Currently it seems that they have developed support for Visual Studio 6.0 only - not .NET...So I guess I'm stuck unless I move to another vision library...

    Just to prove me stupid: a REFGUID - that might be a function-call to this library, right?

    Thanks again!

  8. #8
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Try adding:
    Code:
    #define _NO_SYS_GUID_OPERATOR_EQ_
    to your project settings. You may not even use the inline GUID == operator. Otherwise tweaking of the header file include order may do the trick. Finally, if all else fails you can replace the inline == operator with IsEqualGUID() directly.

  9. #9
    Registered User
    Join Date
    Oct 2002
    Posts
    11
    Thanks, anonytmouse!

    I tried defining _NO_SYS_GUID_OPERATOR_EQ_, and it compiled!

    Then I got an error message about "cannot open msvcirtd.lib". I discovered that this .lib file is placed in "C:\Program Files\Microsoft Visual Studio\VC98\Lib" and "C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib", but NOT in "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib", for some reason.

    This means that the .lib file follows with VS 6.0 and VS .NET, but not with VS .NET 2003...does anybody know why not with .NET 2003?

    Anyway - my application is compiling, linking and running now! Thank you everybody (especially anonytmous)!

  10. #10
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Because .Net 2003 ships with a new version of the library that uses a different name. I think.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 03:09 AM
  2. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09:43 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21