[SOLVED] What is causing this linker error?
-
I am trying to include and use an external library inside my Qt Creator project. The lib was built in Visual Studio 2012 express so I have been sure to download the Visual Studio 2012 version of Qt.
Just to confirm, inside my Build & Run options, I can clearly see 'Qt 5.3 MSVC2012 OpenGL 32bit' and I have tested to make sure that it is defiantly using the VS2012 compiler.
If I build a small test project within VS2012, I get LNK4099 warnings e.g.:
@
ft800emud.lib(ft800emu_audio_driver_wasapi.obj) : warning LNK4099: PDB 'vc110.pdb' was not found with 'ft800emud.lib(ft800emu_audio_driver_wasapi.obj)' or at 'c:\users\me\documents\visual studio 2012\Projects\Project1\Debug\vc110.pdb'; linking object as if no debug info
@
But, the project builds, links and executes just fine like it should do.However, if I create the same project in Qt Creator, I get LNK2019 errors for the same functions that only gave warnings in VS2012:
@
ft800emud.lib(ft800emu_audio_driver_wasapi.obj):-1: error: LNK2019: unresolved external symbol __imp__CoCreateInstance@20 referenced in function "public: static void __cdecl FT800EMU::AudioDriverClass::begin(void)" (?begin@AudioDriverClass@FT800EMU@@SAXXZ)
@
Why do I get these LNK2019 errors instead of LNK4099 warnings when using Qt Creator and how can I resolve this? -
I came back to update this as I have figured out what is going on.
The problem is that VS includes ole32.lib in its additional dependencies by default, but Qt Creator does not.
I added the following line to my .pro file and all was sorted:
win32:LIBS += -lole32Not sure if this will ever help anyone but who knows :)
-
It helped, thanks a lot!