Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
__stdcall and external library
Hi guys, i have a problem with QT 5.
I have a DLL and an LIB file that i have included into my project file.
When i build all project and files i have an error: "undefined reference to...." but i have included all libraries correctly.
All functions that i have called into my program are declared with __stdcall into the .H file, i think that this is the problem!
Someone can help me?
Hi and welcome to devnet,
Are you sure you implemented all the functions in your dll ? Are they exported correctly ?
It isn't my library, i have only received the files from a customer. In the .h file there are:
and this is my .pro file:
What compiler did your supplier used? Different types of compilers use different namemangling options, thus Qt (MinGw) will not find any links to libraries if they are compiled with e.g. MSVC2010.
Better to get a .dll and use QLibrary, or ask the supplier for a library compiled with the same compiler (also type!) as you want to use.
Mhh you're right, i'm using the Qt Compiler! Is there a way to include the MSVC2010 compiler?
There's no Qt compiler, you are either using MinGW or Visual Studio. Which package did you install ?
Visual Studio is available on Microsoft's web site
I'm using MinGW, but i have to create a program with this library on Qt. Is there a way to use it? Or i have to change the compiler?
There is also a Qt package compiled with the MSVC2010 compiler. If your library is compiled with that compiler, install VisualStudio Express 2010, install Qt with the MSVC2010 package, install the Microsoft debugger kit so Qt can debug with that compiler. Then you should have a program that compiles.
Or ask the supplier to compile the library with the MinGw compiler
Ok, but i have already tried to install this plugin for VS 2010...but it doesnt' work because when i try to load a Qt project on VS i have an error: "qmake.exe not found", something like that...
hi, you do not need to load your project in VS!
With the install of VS you also get the compiler. That's why you need to install that, you do not use it.
You open QtCreator and setup your program to use the MSVC2010 compiler and setup the debugger (both should be found automatic, sometimes a restart is needed).
Then create your program in Qt!!
Or otherwise you need to setup a custom made program file in VS to include Qmake.exe etc etc.
Also, don't forget to install Qt built with Visual Studio 2010 (or build it yourself)