1

I have to use the third party static library for my qt application to run on windows. The third party provides me a .lib and .h file for use. These libraries are compiled with MSVC compiler.

My qt Creator is using MinGW compiler to compile my application. I copied the .h and .lib file to my qt project directory and then added those in .pro file as follows

QT += core gui

TARGET = MyTest TEMPLATE = app

LIBS += C:\Qt\2010.05\qt\MyTest\newApi.lib

SOURCES += main.cpp\ mainwindow.cpp

HEADERS += mainwindow.h \ newApi.h

FORMS += mainwindow.ui

Now I am getting some runtime error like this -

Starting C:\Qt\2010.05\qt\MyTest-build-desktop\debug\MyTest.exe... C:\Qt\2010.05\qt\MyTest-build-desktop\debug\MyTest.exe exited with code -1073741515

Can any body suggest is this runtime error is due to mismatch of compiler? (because of my .lib file I added is comipled in MSVC compiler and my qt app is compiled using MinGW compiler)

If not what may be the reason? Am I missing anything in adding the .h and .lib file to my qt project?

If my MinGW compiler will not support the .lib file generated in MSVC compiler what may be the work-arround?

Can I create the .lib files in MinGW compiler? or this format is supported only by MSVC compiler only?

Please suggest...

Surjya Narayana Padhi
  • 7,741
  • 25
  • 81
  • 130
  • Related but not duplicate: http://stackoverflow.com/questions/2529770/how-to-use-libraries-compiled-with-mingw-in-msvc –  Jan 07 '11 at 07:06

2 Answers2

1

If the third party library provides a C++ interface, you have to use the same compiler to build your application. If you cannot afford a commercial version of visual studio you can use an express edition. You should find out which compiler version (2005, 2008, 2010) was used in the library, because otherwise you might run into compatibility problems. For the same reason you will likely have to build a static application - but study the Qt licensing conditions first.

hmuelner
  • 8,093
  • 1
  • 28
  • 39
1

If this issue would be due to a mismatch of the compilers (MINGW vs MSVC) then I would expect that linking the application would fail. But that apparently worked.

It might be an issue with some dependent DLL not being found at application start. Check with dependency walker (http://www.dependencywalker.com/) if all DLLs are available in the search path.

Volker Voecking
  • 5,203
  • 2
  • 38
  • 35