views:

17

answers:

2

Hi,

I am encountering some issues with one project. I need to use two libraries but one needs to be compiled with the /clr switch as the other cannot be compiled with this switch.

Would there be a way to use at the same time those two libraries in one project? Currently it's compiled with /clr and I got linking errors with the noclr library.

If there is no solution I can still launch the noclr library in batchmode but I'd like to avoid it...

My project is in Managed C++, the library tetgen - which needs /clr - is in native C++ and cannot be compiled without the /clr switch, as I get this error

error C3381: 'tetgenio' : assembly access specifiers are only available in code compiled with a /clr option

The other library triangle is in C. I am on Visual Studio 2008 and the project is compiled in 32 bits.

Thanks a lot for any help!

+2  A: 

We could use more details, but using managed C++ you can certainly use a mix of managed and unmanaged code. (Microsoft calls their managed c++ code C++/CLI.)

EDIT:

Ok, your compiler error helped. Apparently you have specified a native class, but using public private, or some other access specifier on the name of the native class. From the MSDN docs:

The following sample generates C3381:

// C3381.cpp
**public** class A {   // C3381. Remove public or make the class
managed. }; 
int main() { }

so get rid of the public keyword, and then try compiling again.

C Johnson
I have just added some details.
ChRtS
Thanks that works!
ChRtS
You could vote it up too.
C Johnson
A: 

You can have multiple projects in a single solution. Right click on the solution in the eolution explorer and add -> existing/new project. Each library project can be added that way and have their own clr settings.

insipid
This project is actually part of a 10-project solution. I just cannot link the noclr library to my project, I got some linking errors. I have tried to link this library to a project I created, not compiled with /clr and containing only call to its functions and it works. Then when I link this intermediate project to my initial project, the compiler says it cannot find the header to the noclr library in the intermediate project.
ChRtS