WinAPI with Qt
-
Should I declare DLL in my source file? That's it?
-
what ide are you using?
if visual studio, then #include <windows.h>
please give more details :)
-
I use Qt Creator and make Qt application. How can I connect DLL to my Qt project?
-
[quote author="RomanShteff" date="1296690300"]I use Qt Creator and make Qt application. How can I connect DLL to my Qt project?[/quote]
See "Declaring Other Libraries":http://doc.qt.nokia.com/4.7/qmake-project-files.html#declaring-other-libraries in the "qmake manual":http://doc.qt.nokia.com/4.7/qmake-manual.html
-
Thanks for link to "Declaring Other Libraries". For example if I have my project in directory
"C:\Project", and my library is "mylib.dll" I should write in .pro-file:@
LIBS += C:\Project\mylib.dll
@Is it correct?
[EDIT: code formatting, Volker]
-
no, wrong
you write:
for MSVC tool chain
@
LIBS += C:\Project\mylib.lib
@for gcc tool chain:
@
LIBS += $$quote(-LC:\Project) -lmylib
@ -
Or better
@win32:LIBS += C:\Project\mylib.lib@
@unix:LIBS += $$quote(-LC:\Project) -lmylib@
-
but if you use gcc on windows, it will have problems with mylib.lib
-
LOL, I usually forget that there is GCC for Windows... :)
-
I use Qt Creator.
-
[quote author="RomanShteff" date="1296749017"]I use Qt Creator.[/quote]
That's the IDE, not the compiler tool chain. You can use both (VisualStudio or GCC/MinGW) with Qt Creator and your .pro file must be set up correctly for the one you use.
The default open source installation of Qt Creator/SDK for Windows comes with MinGW as far as I know.
-
Yeah, I have default open source installation. But I have .dll, not .lib
-
and you then have .a files. and for gcc, you use:
@
LIBS += -L<path to dlls> -l<dll name without extension>
@ -
Thanks to all!