T
Tommy Vercetti
With Visual Studio .NET 2003, I create a new project -> C++ -> Class
library (.NET).
The instant I include a C++ header file such as:
#include <string>
or any other standard C++ header I can think of, the project won't build:
Linking...
LINK : error LNK2020: unresolved token (0A000006) _CxxThrowException
LINK : error LNK2020: unresolved token (0A000017) delete
LINK : fatal error LNK1120: 2 unresolved externals
I've done lots of Internet searches and found many others who have
encountered this exact problem but none have found a solution. Among
suggested solutions that I've tried:
- Changing the Runtime Library option in Project Properties to
"Multi-threaded Debug DLL" from "Multi-threaded Debug". This didn't help.
- Explicitly adding LIBCPMTD.LIB. Didn't help; I assume this is done
automatically.
I don't have these problems with Managed C++ console and windows
applications. Those seem fine. But Managed C++ class libraries seem to
be simply broken.
This seems like a very large blatant bug. I can't even find official
"known bug" type info on Microsoft's site. I've found a knowledge base
article that loosely describes this bug for the 2002 version of Visual
Studio but the article suggests that it would be fixed in subsequent
versions (such as 2003 which I'm using).
Ultimately my goal is to wrap existing C++ code in a .NET library
interface. All the code will compile under the Managed C++ compiler.
library (.NET).
The instant I include a C++ header file such as:
#include <string>
or any other standard C++ header I can think of, the project won't build:
Linking...
LINK : error LNK2020: unresolved token (0A000006) _CxxThrowException
LINK : error LNK2020: unresolved token (0A000017) delete
LINK : fatal error LNK1120: 2 unresolved externals
I've done lots of Internet searches and found many others who have
encountered this exact problem but none have found a solution. Among
suggested solutions that I've tried:
- Changing the Runtime Library option in Project Properties to
"Multi-threaded Debug DLL" from "Multi-threaded Debug". This didn't help.
- Explicitly adding LIBCPMTD.LIB. Didn't help; I assume this is done
automatically.
I don't have these problems with Managed C++ console and windows
applications. Those seem fine. But Managed C++ class libraries seem to
be simply broken.
This seems like a very large blatant bug. I can't even find official
"known bug" type info on Microsoft's site. I've found a knowledge base
article that loosely describes this bug for the 2002 version of Visual
Studio but the article suggests that it would be fixed in subsequent
versions (such as 2003 which I'm using).
Ultimately my goal is to wrap existing C++ code in a .NET library
interface. All the code will compile under the Managed C++ compiler.