473,806 Members | 2,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"mscorlib.d ll" Problem

Hey,
I just downloaded Visual C++ 2005 Express, and I'm reading through a
book called "Visual C++ .NET Step By Step", which was made for 2003.
Just so you know where I'm getting this example.

When I build this code, I get the following compile error.

1>c:\documents and settings\editin g\my
documents\alex\ c++\animal\anim al\animal.cpp(6 ) : fatal error C1190:
managed targeted code requires a '/clr' option

And that is regarding this:

#using <mscorlib.dll >

And then when I had /clr to the options, it then says:

1>cl : Command line error D8016 : '/RTC1' and '/clr' command-line
options are incompatible

So if I shut off /RTC1 in code generation, then it just says that
therer is another thing incompatible (/Gm I think) and it just keeps
going on with incompatibiliti es. Is there any way that I can make this
code work?

////////////////////////////////////////////////////////////////////////

// Animal.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#using <mscorlib.dll >

using namespace System;

__gc class Animal
{
public:
int legs;
void SetName(String *name)
{ strName = strName->Copy(name); }
String* GetName() { return strName; }
private:
String *strName;

};

int _tmain()
{
Animal *cat, *dog;
cat = new Animal;
dog = new Animal;

cat->SetName("Cat") ;
cat->legs = 4;
dog->SetName("Dog") ;
dog->legs = 4;

Console::WriteL ine("Animal 1");
Console::Write( "Name: ");
Console::WriteL ine(cat->GetName());
Console::Write( "Legs: ");
Console::Write( cat->legs);

return 0;

}

//////////////////////////////////////////////////////

I am using a regular Win32 console applications. Thanks alot.

Dec 18 '05 #1
2 5941
"Alex Hardin" <61**********@g mail.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
I just downloaded Visual C++ 2005 Express, ...
When I build this code, I get the following compile error.

1>c:\documents and settings\editin g\my
documents\alex\ c++\animal\anim al\animal.cpp(6 ) : fatal error C1190:
managed targeted code requires a '/clr' option
...
1>cl : Command line error D8016 : '/RTC1' and '/clr' command-line
options are incompatible

So if I shut off /RTC1 in code generation, then it just says that
therer is another thing incompatible (/Gm I think) and it just keeps
going on with incompatibiliti es. Is there any way that I can make this
code work?


You have two choices, easy and hard.

The hard way is to come up to speed on the meaning of the compiler options,
understand the incompatibiliti es and then set the switches appropriately for
your project.

The easy way is to have the wizard generate a project for you and then add
your source (files) to that project.

I don't have the Express Edition loaded here, but when I choose
File->New->Project from the Professional menu, under the C++ project types
there is a CLR choice. If I select that, in the right pane there is a "CLR
Console Application" template. If you are doing ordinary character mode
screen I/O (i.e. no windows) then this is the template you want. Type a name
for your project and click OK

The IDE will create a main() function for you which you can edit..

Just by the way, this is the command line that the IDE uses to build the
project:

/Od /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /FD /EHa /MDd
/Yu"stdafx.h" /Fp"Debug\test.p ch" /Fo"Debug\\" /Fd"Debug\vc80.p db" /W3
/nologo /c /Zi /clr /TP /errorReport:pro mpt /FU
"c:\Windows\Mic rosoft.NET\Fram ework\v2.0.5072 7\System.dll" /FU
"c:\Windows\Mic rosoft.NET\Fram ework\v2.0.5072 7\System.Data.d ll" /FU
"c:\Windows\Mic rosoft.NET\Fram ework\v2.0.5072 7\System.XML.dl l"

Regards,
Will

Dec 18 '05 #2
Hey, thanks alot! That and a combination of other things worked.
Learning what on earth CLR and managed C++ is really helped ;) Thanks
again!

Dec 24 '05 #3

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

Similar topics

5
9114
by: Giles Brown | last post by:
I'm feeling quite dumb this morning. I'm trying to build a COM server DLL using py2exe and it ain't working. Here's what ain't working... setup_dll.py based on py2exe sample: """from distutils.core import setup import py2exe
1
354
by: malcolm | last post by:
Hello, We have a small team building a project that involves some 30 or so c# assembly dlls. It is a client server application with 1 exe as the starting point. The dlls and exe are sharing an assemblyinfo file that has a strong name and version assiciated with it. We are having problems in the way we have been developing. We have made two attempts at this. Attempt 1) In our first attempt, we basically had 1 folder that
4
2327
by: jr | last post by:
I am working in VC++ so this may be microsoft specific though I don't think so. Excuse me if it is. Assuming it isn't, can someone generally explain the purpose of having both - is it purely a deployment/distribution thing. I notice that the static library generates obj files and a Lib file. Could someone kindly explain how they relate to one another. Thanks very much
5
4841
by: ron jacobs | last post by:
I have just implemented a "mixed mode" dll in VC++. I have implemented this dll in accordence with several articles found on the MSDN website including KB 814472. The crux of the problem is that when the dll is built with the \noentry linker option, I can not load the dll in a c# client. There is plenty of help available for loading this dll in a c++ client. Does anyone know how to load this dll in C# or VB?? Am I forced to use...
3
4144
by: Dmitry Jouravlev | last post by:
Hi, I have a number of C++ solutions in Visual Studio .NET and when i compile them using "Whole Program Optimization", certain projects report a LNK1171 error saying that c2.dll could not be loaded. The error contains the correct path to c2.dll (and it is definately there). This only happens on some projects and only when "whole program optimization" option is turned on. If i turn off this option, the problem goes away. I have other...
5
3394
by: Francesc | last post by:
Hi, I'm programming some classes in order to be able to import different text formats (TXT, RTF, HTML, ...) to my own format called RUF. I've defined one Solution within several Projects, each one is focused in one specific format, includes from 5 to 15 classes and produces one DLL. Solution GATEWAY:
0
1126
by: jiabin | last post by:
Hi, I got an exception with the message below, when I'm trying to start my application. "Could not load a type. Failed to partially bind to "System.String, mscorlib". " I did a search on the net, and found no clue. Has anyone seen similar problem, or any clue?
4
4306
by: topmind | last post by:
I tried to install the sqlite extension to PHP using "php_sqlite.dll", but I get the following error message: PHP Warning: Unknown(): Unable to load dynamic library './php_sqlite.dll' - Access is denied. in Unknown on line 0 I am using IIS on Windows XP for development only. It is Php version 4.3.2. I added all permissions I could, including "write". It is finding the DLL okay because if I rename it I get a "not found" message...
0
1412
by: raludamian | last post by:
Hello! I'm trying to develop a GIS mapping software on smart devices (Pocket PC) using VS 2005, C#. I need to use a library that was written in C++. Being open source I compiled the C++ code VS 2005 --C++ --Smart Devices and I obtained a DLL. Now I need to access the DLL functions (unmanaged code) from my C# (managed code) application. Unfortunatelly I got a "Can't find PInvoke dll" problem.
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10620
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10369
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5682
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.