Compile errors including api files



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/01/2003 at 09:47, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.012 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    I am getting a ton of compile a macro redefinition errors when including C4D header files in my project. I ask a developer here what it might be and he says there must be a #define somewhere that isn't hitting in the VC6 compilier from the C4D api that does work with codewarrior?
    When I include windows. h before I include any of the C4D headers, I get erros like : error C2629: unexpected 'int ('  or error C2238: unexpected token(s) preceding ';'
    or if I include windows.h and winsock2.h (which I need) in my project, I get other errors if they are included after the c4d api..
    I already did the massive CRLF conversion of all the C4d api files but am wondering if there are further problems with the header files while trying to build a plugin in VC6
    -eric



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/01/2003 at 09:47, xxxxxxxx wrote:

    Sorry, this is not in COFFEE,  this is C++



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/01/2003 at 11:41, xxxxxxxx wrote:

    here are some of the errors:
      c:\program files\maxon cinema 4d r8\resource\_api\ge_win_math.h(26) : see declaration of 'WORD'
    c:\program files\microsoft sdk\include\winnt.h(817) : note C6311: c:\program files\maxon cinema 4d r8\resource\_api\ge_win_math.h(45) : see previous definition of 'MINLONG'
    c:\program files\microsoft sdk\include\winnt.h(820) : note C6311: c:\program files\maxon cinema 4d r8\resource\_api\ge_win_math.h(51) : see previous definition of 'MAXWORD'
    c:\program files\microsoft sdk\include\winuser.h(7273) : note C6311: c:\program files\maxon cinema 4d r8\resource\_api\ge_prepass.h(838) : see previous definition of 'COLOR_BACKGROUND'
    c:\program files\microsoft sdk\include\wtypes.h(651) : error C2371: 'LANGID' : redefinition; different basic types
            c:\program files\microsoft sdk\include\winnt.h(406) : see declaration of 'LANGID'
    c:\program files\microsoft sdk\include\winsmcrd.h(32) : error C2371: 'UWORD' : redefinition; different basic types
            c:\program files\maxon cinema 4d r8\resource\_api\ge_win_math.h(29) : see declaration of 'UWORD'
    c:\program files\microsoft sdk\include\msxml.h(1883) : error C2143: syntax error : missing ')' before 'constant'
    c:\program files\microsoft sdk\include\msxml.h(1883) : error C2143: syntax error : missing ';' before 'constant'
    c:\program files\microsoft sdk\include\msxml.h(1883) : error C2059: syntax error : 'constant'
    c:\program files\microsoft sdk\include\msxml.h(1883) : error C2059: syntax error : ')'



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/01/2003 at 17:52, xxxxxxxx wrote:

    I've also got strange errors when trying to include windows.h (and some STL headers). The reason always seems to be that #defines aren't very namespace friendly, and neither are windows.h or the C4D SDK.
    The solution is to isolate .cpp files that need to use windows.h from the C4D SDK includes. (A pita, but possible. I created a beep facility this way... :-)
    Another solution would be to create a c4dwindows.h that includes windows.h but takes great care to #undef constants until windows.h and the SDK can happily coexist.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/01/2003 at 19:30, xxxxxxxx wrote:

    Thanks Mikael,
    You wouldn't have any custom header files like the c4dwindows.h you meentioned laying around would you? :)
    2 weeks experience programming C++ here. ;)
    -eric morin



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/01/2003 at 09:37, xxxxxxxx wrote:

    Here's one snippet I got from David O'Reilly:

        
        
        #include <windows.h>
        
        
        
        
        #undef COLOR_BACKGROUND  
        #undef CreateDialog  
        #define Polygon CPolygon
        
        
        
        
        //
        
        
        
        
        #include "c4d.h"  
        #include "c4d_symbols.h"
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/01/2003 at 10:57, xxxxxxxx wrote:

    thanks for the info..
    that seemed to fix some of the problems..
    do you have any insight with compile errors when including winsock2.h?
    some of my errors:
    C:\Program Files\Microsoft SDK\Include\winsock2.h(153) : error C2011: 'timeval' : 'struct' type redefinition
    C:\Program Files\Microsoft SDK\Include\winsock2.h(209) : error C2011: 'hostent' : 'struct' type redefinition
    C:\Program Files\Microsoft SDK\Include\winsock2.h(222) : error C2011: 'netent' : 'struct' type redefinition
    C:\Program Files\Microsoft SDK\Include\winsock2.h(229) : error C2011: 'servent' : 'struct' type redefinition
    C:\Program Files\Microsoft SDK\Include\winsock2.h(467) : note C6311: C:\Program Files\Microsoft SDK\Include\winsock.h(411) : see previous definition of 'SO_DONTLINGER'
    C:\Program Files\Microsoft SDK\Include\winsock2.h(524) : note C6311: C:\Program Files\Microsoft SDK\Include\winsock.h(469) : see previous definition of 'AF_IPX'
    C:\Program Files\Microsoft SDK\Include\winsock2.h(552) : note C6311: C:\Program Files\Microsoft SDK\Include\winsock.h(488) : see previous definition of 'AF_MAX'
    C:\Program Files\Microsoft SDK\Include\winsock2.h(558) : error C2011: 'sockaddr' : 'struct' type redefinition
    C:\Program Files\Microsoft SDK\Include\winsock2.h(598) : error C2011: 'sockproto' : 'struct' type redefinition
    C:\Program Files\Microsoft SDK\Include\winsock2.h(637) : error C2011: 'linger' : 'struct' type redefinition
     
    C:\Program Files\Microsoft SDK\Include\winsock2.h(1744) : error C2375: 'getsockname' : redefinition; different linkage
            C:\Program Files\Microsoft SDK\Include\winsock.h(771) : see declaration of 'getsockname'
    C:\Program Files\Microsoft SDK\Include\winsock2.h(1767) : error C2375: 'getsockopt' : redefinition; different linkage
            C:\Program Files\Microsoft SDK\Include\winsock.h(776) : see declaration of 'getsockopt'
    C:\Program Files\Microsoft SDK\Include\winsock2.h(1788) : error C2375: 'htonl' : redefinition; different linkage
            C:\Program Files\Microsoft SDK\Include\winsock.h(783) : see declaration of 'htonl'
    C:\Program Files\Microsoft SDK\Include\winsock2.h(1805) : error C2375: 'htons' : redefinition; different linkage
            C:\Program Files\Microsoft SDK\Include\winsock.h(785) : see declaration of 'htons'



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/01/2003 at 12:09, xxxxxxxx wrote:

    You need to go through each error and find the cause, usually redefined class/struct names, such as in the Windows.h they aleady have a Polygon, so before the C4D include we create a #define to relabel the C4D Polygon to CPolygon, you need to do the same, but this is not the best way to go about it, if you really need to start including Windows headers (not a good thing really!), then you should not include these in the same header/cpp files, create your functions in isolated a cpp file that only uses the Windows includes, then declare the use of that function/s in your C4D cpp file/s, the linker will take care of the rest. It would be very unusual to need both sets of includes in the same cpp file.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/01/2003 at 12:12, xxxxxxxx wrote:

    oh.. I think I got it now..
    thanks.. it compiled!


Log in to reply