__stdcall and external library
-
wrote on 19 Feb 2014, 09:01 last edited by
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 ?
-
wrote on 20 Feb 2014, 07:19 last edited by
It isn't my library, i have only received the files from a customer. In the .h file there are:
".H File":http://s28.postimg.org/d4uvmb88d/Immagine.png
and this is my .pro file:
".Pro File":http://s27.postimg.org/l5q67n3vn/Immagine.png
-
wrote on 20 Feb 2014, 08:22 last edited by
Hi,
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. -
wrote on 20 Feb 2014, 08:32 last edited by
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
-
wrote on 20 Feb 2014, 09:19 last edited by
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?
-
wrote on 20 Feb 2014, 10:51 last edited by
Hi,
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. -
wrote on 20 Feb 2014, 10:52 last edited by
Or ask the supplier to compile the library with the MinGw compiler
-
wrote on 20 Feb 2014, 10:56 last edited by
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...
-
wrote on 20 Feb 2014, 11:19 last edited by
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)
1/12