
Fatal Error C1010 in Mixing Managed C++ and Unmanaged C++ Code
--------------------
| Content-Class: urn:content-classes:message
| Subject: Re: Fatal Error C1010 in Mixing Managed C++ and Unmanaged C++
Code
| Date: Mon, 17 Mar 2003 07:26:58 -0800
| Lines: 55
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcLsmaaXZT8yl9vfSEeEoUnPI5giqA==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.dotnet.languages.vc
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| Path: cpmsftngxa06!cpmsftngxa08.phx.gbl
| Xref: cpmsftngxa06 microsoft.public.dotnet.languages.vc:21427
| X-Tomcat-NG: microsoft.public.dotnet.languages.vc
|
| Hi Larry, Thanks for your help and adsvice.
|
| (1) I added #include "stdafx.h" to the Mixing1-Hello.cpp
| program and built it in my PC - It worked perfactly.
|
| (2) I added #include "stdafx.h" to the Mixing2-Howdy.cpp
| program and built it in my PC (as Mix2-Hi.cpp) - I got 7
| errors listed below:
|
| ------ Build started: Project: Mix2-Hi, Configuration:
| Debug Win32 ------
|
| Compiling...
|
| Mix2-Hi.cpp
|
| Mix2-Hi.cpp(24) : error C2871: 'System' : a namespace with
| this name does not exist
|
| Mix2-Hi.cpp(28) : error C2143: syntax error : missing ';'
| before '<'
|
| Mix2-Hi.cpp(28) : error C2501: 'CppClass::gcroot' :
| missing storage-class or type specifiers
|
| Mix2-Hi.cpp(28) : error C2238: unexpected token(s)
| preceding ';'
|
| Mix2-Hi.cpp(34) : error C2039: 'str' : is not a member
| of 'CppClass'
|
| Mix2-Hi.cpp(26) : see declaration of 'CppClass'
|
| Mix2-Hi.cpp(34) : error C2061: syntax error :
| identifier 'String'
|
| Mix2-Hi.cpp(34) : fatal error C1190: managed targeted code
| requires '#using <mscorlib.dll>' and '/clr' option
|
| Build log was saved at "file://c:\C++Projects\Mix2-
| Hi\Debug\BuildLog.htm"
|
| Mix2-Hi - 7 error(s), 0 warning(s)
|
| ---------------------- Done ----------------------
|
| Build: 0 succeeded, 1 failed, 0 skipped
| ************************************************8
| I do not know how to correct them - I am new in C++ and
| Visual C++.NET programmings and I do not know how to put
| the appropriate #include at the head of the file as you
| instructed for the Minxing2-Howdy.cpp case. Please help me
| again and tell me how to solve this new problem.
| Thanks,
| Scott Chang
|
You may wont to put the #include "stdafx.h" statement on the first line in
the cpp file and not after the one with #using <mscorlib.dll>
e.g.
#include "stdafx.h"
#using <mscorlib.dll>
#include <vcclr.h>
using namespace System;
In this case the order makes a difference.
--
Silviu Guea, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.