473,386 Members | 1,791 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,386 software developers and data experts.

mscorlib.dll problem (Visual C++ 2005)

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\editing\my
documents\alex\c++\animal\animal\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 incompatibilities. 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::WriteLine("Animal 1");
Console::Write("Name: ");
Console::WriteLine(cat->GetName());
Console::Write("Legs: ");
Console::Write(cat->legs);

return 0;
}

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

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

Dec 17 '05 #1
4 5193
Alex Hardin wrote:
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.


http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

HTH,
- J.
Dec 17 '05 #2
"Alex Hardin" <61**********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com
Hey,
I just downloaded Visual C++ 2005 Express, and I'm reading through a
book called "Visual C++ .NET Step By Step",
Judging by the reviews on Amazon, it is a dreadful book.
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\editing\my
documents\alex\c++\animal\animal\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 incompatibilities. 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::WriteLine("Animal 1");
Console::Write("Name: ");
Console::WriteLine(cat->GetName());
Console::Write("Legs: ");
Console::Write(cat->legs);

return 0;
}

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

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


The example involves managed code, which is a non-standard Microsoft
extension to C++ (and hence off-topic on this
newsgroup). Incidentally, the version of managed code supported by VC++ 2003
(and discussed in the book you have) is effectively obsolete, replaced by
C++/CLI in VC++ 2005.

The correct place to ask about this stuff is

microsoft.public.dotnet.languages.vc
--
John Carson
Dec 18 '05 #3
Okay thanks, I did get the problem fixed on the other group. I didn't
read anything about the book, I just saw it at the library and picked
it up. I'll try and look for a 2005 book then. Or something. Thanks
again guys.

Dec 18 '05 #4

Alex Hardin wrote:
Okay thanks, I did get the problem fixed on the other group. I didn't
read anything about the book, I just saw it at the library and picked
it up. I'll try and look for a 2005 book then.


You probably don't want to look at all the 2005 extensions before
learning
the base language proper. Have a look at www.accu.org. It has a lot of
book
reviews, rated by experts. One of the better books is Accelerated C++,
by
A.Koenig. It's good for novices, either new to C++ or to programming in

general. If you're one of the latter, don't be fooled by the thin
appearance.
It's complete, but has little fluff.

HTH,
Michiel Salters

Dec 19 '05 #5

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

Similar topics

1
by: rupert | last post by:
I have loaded Xll+ which is a excel development addin. I have included as first line of my VC++ module (visual studio.net 2003): #using <mscorlib.dll> and yet get compile error: fatal...
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...
3
by: Pieter | last post by:
Hi, I have a Windows Forms application (VB.NET 2.0) which uses a Class Library in C#. The application runs fine, but when I run it in debug mode, I get several "A first chance exception of type...
2
by: Alex Hardin | last post by:
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. ...
0
by: Steve | last post by:
I am using Visual Studio .NET 2003, which has .NET framework 1.1. When I tried to run .NET web services client, I got the following error: Security Exception Error Message: An unhandled...
0
by: richlm | last post by:
I downloaded the Spy++ sample from http://msdn.microsoft.com/msdnmag/issues/06/04/ManagedSpy/ It works and builds fine on my desktop PC (which is a recent clean install of XP + Visual Studio...
0
by: catharticmomentusenet | last post by:
Hi, I'm receiving the error message: fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2708) This seems to be associated with the line of code: #import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.