settting /CLR per file in VS 2005

B

bonk

I was told that it is possible to set the /clr compiler switch on a per
file basis. I find this option in the project settings for the .cpp
files. However that does not affect the header files. So if I have a
class that has managed members setting the /clr on a per file basis does
not work. ( for example it will tcomplain about using the ^ requires the
/clr switch)
 
C

Carl Daniel [VC++ MVP]

bonk said:
I was told that it is possible to set the /clr compiler switch on a
per file basis. I find this option in the project settings for the
.cpp files. However that does not affect the header files. So if I
have a class that has managed members setting the /clr on a per file
basis does not work. ( for example it will tcomplain about using the
^ requires the /clr switch)

Naturally.

If you have a class that has managed membrers, then every file that sees
(uses, instantiates, touches, whatever) that class must be compiled as
managed code and will need to be compiled with /clr.

Bottom line: you need to design and manage the boundary between your
managed and unmanaged code carefully in order to really keep the two
separate.

-cd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top