473,385 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Detecting mscorlib.dll?

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.
Nov 17 '05 #1
6 3225
I'd like something like the following:
#ifnusing mscorlib.dll


#ifdef _MANAGED

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 17 '05 #2
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.
Nov 17 '05 #3
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
Nov 17 '05 #4
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.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 17 '05 #5
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
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 17 '05 #6
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
class.

I have this in header of a dialog class within project:
#using <System.xml.dll>
using namespace System::Xml;
I have this in the OnInitDialog() as a test:

#pragma push_macro("new")
#undef new
XmlTextWriter *writer = new
XmlTextWriter("c:\\titles.xml", 0);
// Set the formatting
writer->Formatting = Formatting::Indented; // Write the standard document start
writer->WriteStartDocument();

writer->WriteStartElement("geology");
// Start the volcano element
writer->WriteStartElement("volcano");
// Do the name attribute
writer->WriteAttributeString("name", "Mount St.Helens"); // Write the location element

writer->WriteStartElement("location");
writer->WriteString("Washington State, USA"); writer->WriteEndElement();

writer->WriteEndElement();
writer->WriteEndElement();
// Flush and close
writer->Flush();
writer->Close();
#pragma pop_macro("new")
This compiles fine in Debug but not in Release mode which causes the following error message:
"An unhandled exception of type 'System.NullReferenceException' occurred in Project.exe
Additional information: Object reference not set to an instance of an object."

I have adjusted compile switch settings repleatedly to try to get this
to work.


Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tom van Dijck | last post by:
Hi I'm currently in the process of writing my own mscorlib.dll, this in order to write my own Virtual Machine. Now all may seem a bit useless, but I'd like to use C# as scripting for our game...
2
by: MFRASER | last post by:
I am getting a System.Security.SecurityException when I try and laod a dataset from an xml file any ideas on what would cause this? System.Security.SecurityException' occurred in mscorlib.dll ...
0
by: Michael R. Pierotti | last post by:
Has anyone seen this error before when trying to make the install on a program. ------ Starting pre-build validation for project 'HafaSMPPInstall' ------ WARNING: Unable to find dependency...
4
by: Earl | last post by:
Created a .dll to use in multiple projects. Very simple, one class to return a purpose for a particular version. But when I added it as a reference to one of my other projects, I get a build error...
3
by: DJTN | last post by:
I'm getting the following error when I try to compile my setup project in VS 2002. I have re-installed the .net framework 1.1 and it didnt solve the problem. WARNING: Unable to find dependency...
0
by: qiang | last post by:
Hi everyone, Could you please take a look at an exception for ASP.NET application? My ASP.NET application is using Infragistics WebChart control. I encounter an exception below when...
0
by: paulodonnell99 | last post by:
Hi, I am trying to build an installer application to run on the compact framework, I want to produce a netmodule using CSC.exe, then use AL.exe to embed resouce files and produce an exe. My...
3
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type...
13
by: John W. | last post by:
Hi there, Does anyone know if there's a (simple) way to detect whether an arbitrary "System.Type" originates from the .NET framework opposed to a user-defined assembly. Thanks.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.