tags:

views:

1724

answers:

4
+4  A: 

These are standard library references. Make sure that all libraries (including the standard library) are using the same linkage. E.g. you can't link statically while linking the standard lib dynamically. The same goes for the threading model used. Take special care that you and the 3rd party library use the same linkage options.

This can be a real pain in the *ss.

Konrad Rudolph
A: 

After trying to get this stuff to compile under VS 2008, I tried earlier versions of VS - 2005 worked with warnings, and 2003 just worked. I double checked the linkages and couldn't find any problems, so either I just couldn't find it, or that wasn't the problem.

So to reiterate, downgrading to VS 2003 fixed it.

Matt McMinn
+2  A: 

Check this on MSDN:

  • /MD Causes your application to use the multithread- and DLL-specific version of the run-time library.
  • /MT Causes your application to use the multithread, static version of the run-time library.

Note: "... so that the linker will use LIBCMT.lib to resolve external symbols"

So you'll need a different set of libraries.

How I went about finding out which libraries to link:

  1. Find a configuration that does link, and add /verbose option.
  2. Pipe the output to a text file.
  3. Try the configuration that doesn't link.
  4. Look in the verbose output from step 2 for the symbols that are unresolved ("_declspec(dllimport) public: void thiscall std::locale::facet::Register(void)" in your case) and find the used libraries.
  5. Add those libraries to the list of libraries you're linking to.

Old skool but it worked for me.

Jan

jan
+2  A: 

If you still wish to get the project to compile using VS2008 (or in the future) I can suggest using a binary editor to view the object file in question mainapp.obj.

Here is an example from a small project of mine.

The zdbException.obj contains the following excerpt

DEFAULTLIB:"libc
pmtd" /DEFAULTLI
B:"uuid.lib" /DE
FAULTLIB:"uuid.l
ib" /include:?id
@?$num_put@DV?$o
streambuf_iterat
or@DU?$char_trai
ts@D@std@@@std@@
@std@@2V0locale@
2@A /include:?id
@?$numpunct@D@st
d@@2V0locale@2@A
 /DEFAULTLIB:"LI
BCMTD" /DEFAULTL
IB:"OLDNAMES" /E
DITANDCONTINUE 

Note the entry /DEFAULTLIB:"LIBCMTD". This indicates the object file was compiled with the static c run-time multi-threaded debug.

There is also the possibility that the functions referenced in the obj are deprecated in the standard run-time lib shipped with VS2008.

Henk