views:

711

answers:

2

I am having some trouble converting an old project from VS6 to VS2005. At one place in the code it uses the type variant_t so it includes comdef.h for this purpose. comdef.h then includes comutil.h which generates these errors for me:

c:\program files\microsoft visual studio 8\vc\include\comutil.h(978) : error C2535: '_variant_t::_variant_t(int) throw()' : member function already defined or declared
    c:\program files\microsoft visual studio 8\vc\include\comutil.h(970) : see declaration of '_variant_t::_variant_t'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1007) : error C2535: '_variant_t::operator int(void) const' : member function already defined or declared
    c:\program files\microsoft visual studio 8\vc\include\comutil.h(998) : see declaration of '_variant_t::operator int'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1037) : error C2535: '_variant_t &_variant_t::operator =(int)' : member function already defined or declared
    c:\program files\microsoft visual studio 8\vc\include\comutil.h(1029) : see declaration of '_variant_t::operator ='
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1331) : error C2084: function '_variant_t::_variant_t(int) throw()' already has a body
    c:\program files\microsoft visual studio 8\vc\include\comutil.h(970) : see previous definition of '{ctor}'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1588) : error C2084: function '_variant_t::operator int(void) const' already has a body
    c:\program files\microsoft visual studio 8\vc\include\comutil.h(998) : see previous definition of '.H'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(2006) : error C2084: function '_variant_t &_variant_t::operator =(int)' already has a body
    c:\program files\microsoft visual studio 8\vc\include\comutil.h(1029) : see previous definition of '='

There is probably some configuration that is incorrect, some define missing or some include file I should have included but I can't seem to find the problem. Any pointers in the right direction is much appreciated

A: 

Does your own code do something like this:

#define long int
Windows programmer
Haha, you where right! when I searched around for defines I found this: #ifdef WIN32 #define bool int #define true 1 #define false 0 typedef int ssize_t; #define RET "\r\n"; #define mystring CString #endifHorrible working on old code sometimes! But huge thanks!
Dan
A: 

This looks like one of two things, an include order problem or as you stated something not getting defined but I am leaning towards the first one. You might want to check msdn and make sure there are no restrictions on when comutil.h can be included (I know this is an issue if you include winsock2.h before windows.h). There is also an option under C/C++ > Advanced to Show Includes (/showIncludes option from the command-line) which is generally helpful when trying to track issues like this down.

Kevin Loney