Using vc++ libraries in a MinGW QT project
So have a user interface that I wrote using MinGW QT. In the UI I'm trying to reference objects from my Visual Studio project. Some objects I can reference and use just fine, but the one I'm having problems with uses a 3rd party COM object.
These are the errors I'm getting:
undefined reference to 'CoInitialize@4'
undefined reference to 'CoCreateInstance@20'
I've read that you can't easily mix MinGW and VS libraries. The catch is, Some of the GUI libraries I'm using only compile with MinGW, so I can't just change QT to use the Microsoft compiler.
Is there any way I can get it to recognize these fun开发者_如何转开发ctions, or am I going to end up having to rewrite everything?
I've tried including the 3rd party dll in the .pro file, but that doesn't fix anything.
Those are linking errors, you just need to link with whatever lib has the COM functions (ole32 according to a quick google). You can probably call code in a dll compiled with msvc from mingw, as long as it's C code not C++ though.
MSVC and MinGW are not ABI compatible, so you need to compile all modules with same compiler to avoid this kind of problems.
精彩评论