G
Guest
Hello everyone
I'm encountering a R6002 Runtime error and several bugs when trying to generate a simple Managed C++ application with .NET 2003. The main problem seems to arise from linking with LIBCMT(D).DLL. (My requirement is that we can't link with MSVCRT(D).LIB.) Below are steps I've followed, and the resulting problems
1. Using the New Project wizard, generate a Visual C++ .NET Class Library project (call it "Doomed") and a VC++ .NET Console Application as a tester (call it "DoomedTester") for the Class Library project. Compile both
BUG #1: When compiling the Doomed class library project, the linker yields the following warning
nochkclr.obj : warning LNK4099: PDB 'libc.pdb' was not found with 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib\nochkclr.obj' or at 'C:\Projects\Doomed\Debug\libc.pdb'; linking object as if no debug inf
2. Add the following code to Doomed.h inside Doomed::Class1
file: Doomed.
-------------
// Doomed.
#pragma onc
using namespace System
namespace Doome
public __gc class Class
public: // Add thi
static void f(); // Add thi
}
3. Add the following code to Doomed.cpp and recompile
file: Doomed.cp
---------------
// This is the main DLL file
#include "stdafx.h
#include <cstdio> // Add thi
#include "Doomed.h
// Add the following code
namespace Doome
void Class1::f(
printf("%f", 1.0)
4. The linker can't resolve printf(), so add LIBCMTD.LIB to Linker->Input->Additional Dependencies, and relink
BUG #2: The linker returns with the following error
LIBCMTD.LIB(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartu
(Note: This could be resolved by linking with MSVCRTD.LIB instead, but this isn't what I want to do.
5. Add the dummy code "int main() {}" to Doomed.cpp and rebuild, which resolves the above linker error
BUG #3: The compiler didn't notice that my dummy main() isn't returning a value
6. Add the following code to DoomedTester.cpp and rebuild
file: DoomedTester.cp
---------------------
// This is the main project file for VC++ application project
// generated using an Application Wizard
#include "stdafx.h
#using <mscorlib.dll
#using <Doomed.dll> // Add thi
using namespace System
int _tmain(
Doomed::Class1::f(); // Add thi
return 0
7. Run DoomedTester.exe
BUG #4: I get the following exception
An unhandled exception of type 'System.StackOverflowException' occurred in doomed.dl
(Note: Again, this could be resolved by linking with MSVCRTD.LIB instead, but this isn't what I want to do.
8. From MS KB article 814472 (http://support.microsoft.com/?id=814472), follow the "Modify DLL That Contains Consumers That Use Managed Code and DLL Exports or Managed Entry Points" discussion and add ManagedWrapper.cpp to the Doomed project, and add the appropriate calling code to DoomedTester.cpp, and recompile. (Note at this point that I can remove the dummy main() from step 5, since there is code inside ManagedWrapper.cpp that implements DllMain().
BUG #5: The compiler fails with the following error
ManagedWrapper.cpp(46) : fatal error C1010: unexpected end of file while looking for precompiled header directiv
9. Add #include "stdafx.h" to the top of ManagedWrapper.cpp and recompile
10. Run DoomedTester.exe
BUG #6: I receive the following runtime error
Debug Error
Program c:\projects\doomed\debug\DoomedTester.ex
R600
- floating point not loade
At this point, I'm stuck. Is there anything I can do to eliminate this floating-point runtime error?
Thanks very much in advance
Whitney Ke
Software Enginee
Rain Bird Corporatio
http://www.rainbird.com
I'm encountering a R6002 Runtime error and several bugs when trying to generate a simple Managed C++ application with .NET 2003. The main problem seems to arise from linking with LIBCMT(D).DLL. (My requirement is that we can't link with MSVCRT(D).LIB.) Below are steps I've followed, and the resulting problems
1. Using the New Project wizard, generate a Visual C++ .NET Class Library project (call it "Doomed") and a VC++ .NET Console Application as a tester (call it "DoomedTester") for the Class Library project. Compile both
BUG #1: When compiling the Doomed class library project, the linker yields the following warning
nochkclr.obj : warning LNK4099: PDB 'libc.pdb' was not found with 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib\nochkclr.obj' or at 'C:\Projects\Doomed\Debug\libc.pdb'; linking object as if no debug inf
2. Add the following code to Doomed.h inside Doomed::Class1
file: Doomed.
-------------
// Doomed.
#pragma onc
using namespace System
namespace Doome
public __gc class Class
public: // Add thi
static void f(); // Add thi
}
3. Add the following code to Doomed.cpp and recompile
file: Doomed.cp
---------------
// This is the main DLL file
#include "stdafx.h
#include <cstdio> // Add thi
#include "Doomed.h
// Add the following code
namespace Doome
void Class1::f(
printf("%f", 1.0)
4. The linker can't resolve printf(), so add LIBCMTD.LIB to Linker->Input->Additional Dependencies, and relink
BUG #2: The linker returns with the following error
LIBCMTD.LIB(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartu
(Note: This could be resolved by linking with MSVCRTD.LIB instead, but this isn't what I want to do.
5. Add the dummy code "int main() {}" to Doomed.cpp and rebuild, which resolves the above linker error
BUG #3: The compiler didn't notice that my dummy main() isn't returning a value
6. Add the following code to DoomedTester.cpp and rebuild
file: DoomedTester.cp
---------------------
// This is the main project file for VC++ application project
// generated using an Application Wizard
#include "stdafx.h
#using <mscorlib.dll
#using <Doomed.dll> // Add thi
using namespace System
int _tmain(
Doomed::Class1::f(); // Add thi
return 0
7. Run DoomedTester.exe
BUG #4: I get the following exception
An unhandled exception of type 'System.StackOverflowException' occurred in doomed.dl
(Note: Again, this could be resolved by linking with MSVCRTD.LIB instead, but this isn't what I want to do.
8. From MS KB article 814472 (http://support.microsoft.com/?id=814472), follow the "Modify DLL That Contains Consumers That Use Managed Code and DLL Exports or Managed Entry Points" discussion and add ManagedWrapper.cpp to the Doomed project, and add the appropriate calling code to DoomedTester.cpp, and recompile. (Note at this point that I can remove the dummy main() from step 5, since there is code inside ManagedWrapper.cpp that implements DllMain().
BUG #5: The compiler fails with the following error
ManagedWrapper.cpp(46) : fatal error C1010: unexpected end of file while looking for precompiled header directiv
9. Add #include "stdafx.h" to the top of ManagedWrapper.cpp and recompile
10. Run DoomedTester.exe
BUG #6: I receive the following runtime error
Debug Error
Program c:\projects\doomed\debug\DoomedTester.ex
R600
- floating point not loade
At this point, I'm stuck. Is there anything I can do to eliminate this floating-point runtime error?
Thanks very much in advance
Whitney Ke
Software Enginee
Rain Bird Corporatio
http://www.rainbird.com