2

I'm trying to use a 3rd party driver from an app in Qt Creator. This app has to be included as a static library. It won't compile without the /MT flags. After much heartache, I've gotten it down to two linker errors:

msvcrtd.lib(ti_inst.obj):-1: error: LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
msvcrtd.lib(ti_inst.obj):-1: error: LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)

I think this problem is described here. If that's the case, then I suppose I need to know how to force Qt Creator to link these system libraries in a specific order, when I haven't even included them explicitly in the .pro file in the first place. If someone could tell me how to do that, that'd be great. If, however, this isn't the same problem described on the MS page, an explanation of what I'm really doing wrong, would be even better.

kanders84152
  • 1,251
  • 10
  • 17
  • You should be able to hand-edit the .pro file and play with the library ordering and see if it helps. – Vaibhav Desai Feb 27 '13 at 06:52
  • The .pro file doesn't include the msvcrt library. I believe that library is included automatically by the MSVC compiler. When I do try to include `CONFIG += ordered` and then the libs in the correct order, I get this: `msvcurt.lib(ti_inst.obj):-1: error: LNK1313: pure module detected; cannot link with ijw/native modules` – kanders84152 Feb 27 '13 at 14:40
  • Never mind. I was linking against the wrong msvc library. Supposed to use `msvcmrt.lib` and not `msvcurt.lib` nor `msvcprt.lib`. It seems to work now. Thanks, all. – kanders84152 Feb 27 '13 at 14:48
  • Maybe post it as an answer to mark it solved? – Marc Plano-Lesay Jul 10 '13 at 13:01

1 Answers1

0

Just to get this marked as answered, I'll quote kanders84152: "Never mind. I was linking against the wrong msvc library. Supposed to use msvcmrt.lib and not msvcurt.lib nor msvcprt.lib. It seems to work now. Thanks, all."

bks
  • 1,360
  • 6
  • 7