Detecting mscorlib.dll?

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.
 
G

Guest

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.
 
G

Guest

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
 
A

alan93

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.
 
A

alan93

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
 
A

alan93

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
 

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

Similar Threads

fatal error C1190 in VC++ .NET 6
/clr option 2
newbie help ?? -> mscorlib.dll 2
mscorlib.dll 3
Managed code within unmanaged code ? 3
UrlDecode in C++? 5
CStrings and managed Code 1
Newbie Problem 3

Top