PDA

View Full Version : [Qt Creator / qmake] - linking shared libraries on Windows



rbrafi
21st April 2012, 04:18
Hi,
I've got a problem. It is probably pretty simple, but I can't find any answer on the net.
I'm working on shared library that depends on other shared libraries. I've added header files in qmake and tried many times to link other dll but failed.
So in theory there is something I called 'my.dll' - it's the one i'm developing and an 'external.dll'
I tried:

LIBS += -L../external -lexternal

LIBS += ../external/external.dll
and many other but I am still getting error
external: No such file or directory at the place where in my code is line:
#include <external>
Please, help me! :o

ChrisW67
21st April 2012, 04:35
The error message is coming from your C++ pre-processor and has nothing to do with your linker (which is what consumes the LIBS options). This line:


#include <external>

tells the pre-processor that there is a file literally called "external" and that it should be searched for on the system include path (and not in the current directory first). The error is telling you this is not correct.

Chances are that the file is actually called "external.h" and that it does not exist on the system include path but in the source directory your external library was built from. You can adjust the path searched by the pre-processor using the INCLUDEPATH variables in your PRO file, or you can specify the location of the file like:


#include "external.h"
#include "../external/external.h"

rbrafi
21st April 2012, 11:36
Thank you :o! I've lost about 5 hours thanks to my own stupidity :(