Using STL with CodeWarrior

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

On 28/03/2003 at 07:02, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   8.100 
Platform:   Windows  ; Mac  ;  
Language(s) :     C++  ;

---------
I'm using CodeWarrior under Windows to build a plugin for a Mac target, and having problems using STL.

If I don't use the STL (Standard Template Library) then it compiles cleanly. My code doesn't need the math library functions (sin(), cos(), etc) but if I use them it still compiles cleanly, so the compiler is finding the maths header/library.

If I add the line:

#include <vector>

to the top of the file prior to the 'c4d.h' include, then I get compiler errors saying that cos() and sin(), etc cannot be found. This applies even if I'm not using those functions.

If I move the above include statement to after the 'c4d.h' include, I get a different error stating that 'offsetof' is being redefined.

I note that the STL is not used at all in the SDK examples (which compile cleanly).

So, there seems to be some nasty interaction between the '#include <vector>' and the '#include "c4d.h"', which means that I can't use the STL. This behaviour isn't limited to the vector container, either.

Any comments, suggestions, etc?

Cheers - Steve

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

On 28/03/2003 at 10:30, xxxxxxxx wrote:

This is how I do it:

    
    
    // xlentstl.h:  
      
    #ifndef XLENT_STL_H  
    #define XLENT_STL_H
    
    
    
    
    #undef offsetof  
    #include <vector>  
    #include <set>  
    #include <algorithm>
    
    
    
    
    #endif
    
     
    
      
      
      
    // myalgorithm.cpp  
      
    #include "c4d.h"  
    #include "c4d_symbols.h"  
    #include "xlentstl.h"  
      
    void Function(BaseContainer& bc)  
    {  
     using namespace std;  
      
     vector<String> list;  
    }

This compiled fine in CW8.

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

On 28/03/2003 at 11:30, xxxxxxxx wrote:

Aha! Yes, that works - thanks!