Domanda

I am trying to recompile some code I have for a new system. It involves a precompiled static library that I do not have the source code for (just the header), and this library was built with VC++ 6.0 or older with the older runtime libraries. On my old system, which had VC++ 6.0, my program was built and ran fine, but I have recently upgraded things and I no longer have access to VC++ 6.0, only Express 2008 (9.0 w/ SP).

When I build the solution, it compiles but has the following linker error:

1>libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in NOREC.lib(track.obj) 1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::bad_cast::bad_cast(char const *)" (??0bad_cast@std@@QAE@PBD@Z) already defined in NOREC.lib(track.obj) 1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::bad_cast::bad_cast(class std::bad_cast const &)" (??0bad_cast@std@@QAE@ABV01@@Z) already defined in NOREC.lib(track.obj) 1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall std::bad_cast::~bad_cast(void)" (??1bad_cast@std@@UAE@XZ) already defined in NOREC.lib(track.obj) 1>LINK : fatal error LNK1104: cannot open file 'libcp.lib'

Any ideas how to overcome this issue would be very welcome.

È stato utile?

Soluzione

From the last link error, libcp.lib cannot be found. This library has been removed as of VS 2005. Use /MT for the multithreaded version.

http://msdn.microsoft.com/en-us/library/abx4dbyh%28v=vs.80%29.aspx

The multithreaded version is libcpmt.lib which you will get automatically with the /MT flag. I see in the first error you are using libcpmtd.lib which is the debug version of the same. I'm not sure how you are getting that if you are not using /MTd. (or if you are, how libcp.lib is referenced since you should be using one or the other, not both)

Altri suggerimenti

The linker is telling you that some symbols are defined more than once. The brute force to convice the linker to produce your target image is to use the /FORCE:MULTIPLE as explained here. I used to use this switch a few times.

LINK : fatal error LNK1104: cannot open file 'libcp.lib'

This is a bug in the linker. Just create an empty file named libcp.lib in the LIBPATH.

libcp.lib you can find in installed MS Visual Studio 6.0 in

c:\Program Files\Microsoft Visual Studio\VC98\Lib\ 

directory.

Just copy it to your MSVS 2005/2008/2010 lib directory (i.e. c:\Program Files\Microsoft Visual Studio 8\VC\lib\) And everything will compiled just fine.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top