Detecting mscorlib.dll?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a header that is included from some files that use mscorlib and some that don't use it. One of the macros in this file uses the __pin keyword. When this header is compiled with a source file that doesn't use mscorlib I get the following error:

fatal error C1190: managed targeted code requires '#using <mscorlib.dll>' and '/clr' optio

I'd like something like the following
#ifnusing mscorlib.dl
#define MY_MACRO(x) __pin
#els
#define MY_MACRO(x)
#endi

Its the first line I'm having trouble with.
 
Thanks for the reply

It doesn't work exactly right. It seems to indicate whether the /clr option is used. The way the project is setup now, the entire project has this option and only certain files have the #using statement. So they all end up having _MANAGED defined

If there are no other suggestions I might just change the /clr option on a per file basis.
 
Hi Mccoyn
i have the same problem and i solve it in the following way
1) Go To ---Project Property->Configuration Property --->c/c++ --->/cl
2) Go To ---Project Property->Configuration Property --->Code Generation-->Basic Runtime Checks-->Default
3) Go To ---Project Property->Configuration Property --->Code Generation-->Enable Minimal Rebuild--> N
4) Go To ---Project Property->Configuration Property --->c/c++ -->General-->Debug Information Format-->Program Database (/Zi
5) Go To ---Project Property->Configuration Property --->Code Generation-->Runtime Library--><inherit from project defaults

those settings solve the proble
try it
but remember its change the entire project propert
have a nice day
Gabi
 
your 1.) doesn't make sense. set what to /clr?

I am trying to use XMLTextWriter in a managed code project and got the
same error indicated above.
 
if I add /clr to command line under C++ which is what I guess you
meant.

I get:
Command line error D2016 : '/RTC1' and '/clr' command-line options are
incompatible
 
i gave up on trying to get XMLTextWriter to work in managed code.
:cry:
This is an e-mail I sent to a microsoft rep and they didn't know why
it wouldn't work.

I am trying to use the XmlTextWriter
 
Back
Top