How to ignore new C++ (2005) keywords that are used in existing unmanaged C++

  • Thread starter Thread starter Brian Richards
  • Start date Start date
B

Brian Richards

I have a library that's a mixed mode dll and compiles fine in in VS2005 with
/clr:oldSyntax. However, if I change it to /clr so I can use the newer
syntax it won't compile because the header files I'm including have invalid
syntax, i.e. the word generic is used for parameter names. I tried wrapping
the include with #pragma unmanaged but to no avail. Is there a way I can
compile this file and have it use /clr:OldSyntax just for that included
section? Optionally is there a way for me to extern the unmanaged class
definition so that it's made available at link time instead of compile time?
That way I could possible not include the broken header at all.


Thanks

Brian
 
why not rename name of the parameter in order to avoid confliction?
you can also try to define generic to something else, eg

#define generic param_generic
#include "xxx.h"
#undefine generic
 
I'm not renaming because I don't own the headers that I'm including. I'll
try the #define trick though
 
Thanks the #define trick worked.


why not rename name of the parameter in order to avoid confliction?
you can also try to define generic to something else, eg

#define generic param_generic
#include "xxx.h"
#undefine generic
 
Back
Top