Errors when linking VC6 library

  • Thread starter Thread starter Christoph Wienands
  • Start date Start date
C

Christoph Wienands

Hello everybody,

I'm a C# programmer that recently was forced to look into Managed C++.
Please forgive me if I might be asking stupid questions ;-)

I currently have to write a wrapper class around a VC6 DLL, which exposes a
few classes. I need to wrap those classes and expose them as a .Net assembly
so they can be used from other .Net languages.

When I try to link to the lib file, I get a whole bunch of linking errors.
Here are two typical ones:

"already defined" error:
ManagedCPP error LNK2005: "public: __thiscall std::locale::locale(void)"
(??0locale@std@@QAE@XZ) already defined in
InspectorProject.lib(XmlGenerator.obj)

"unresolved external symbol" error:
ManagedCPP error LNK2001: unresolved external symbol "__int64 const
std::_Fpz" (?_Fpz@std@@3_JB)

I googled for quite a while and I came across a couple of postings that were
talking about msvcrt.dll, about incompatibilities between versions, using
STD, etc. This lib does not pass around any STD objects, just char*, so I
figured it can't be that problem. Does anybody have an idea where I have to
start searching for the problem?

Thanks, Christoph
 
Make sure you use exactly the same C runtime library and the same C++
library in everything you link together into one images. E.g. do mix
versions from 6.0 with versions form 7.0 or 7.1 (or any other combination)
and don't mix debug and non debug, static or dynamic and single threaded or
multithreaded.

Ronald Laeremans
Visual C++ team
 
Back
Top