Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Problems to compile a static library project
I am new on this forum, and don't know if the post is at the good place. Let me know if i am wrong writing in this section.
Today, i want to compile a static library with Qt. I started with a light sample code. I have a single class containing a QString attribute.
When i compile this little project, i get a single error :
QString : no such file or directory
I really don't know why this error happened. I also trie to add QT += core to the .pro file with no more result.
Here is the sample code :
And the .pro file :
QT -= gui
TARGET = SampleLibrary
TEMPLATE = lib
CONFIG = staticlib
SOURCES += SampleLibrary.cpp
HEADERS += SampleLibrary.h
Someone here could help to resolve it ?
MarianMMX last edited by
bq. add QT += core to the .pro
Hi and welcome to devnet,
[quote author="MarianMMX" date="1384286077"]Remove
Why remove the include ? How would he be able to use QString in that case ?
What OS. Qt version and IDE are you using ?
Hi, thanks for your replies. I am using ubuntu 13.04 and Qt4.8.5.
And how do you build your library ?
Sorry, i am late to reply ...
To build the library, i just created a C++ Library project with QtCreator (the last version avaible).
I added the "CONFIG = staticlib" to the project file to specify i want to build it as a static library (was configured to build a dynamic one into .so files).
The library provides many classes to support the xPL protocol (see http://xplproject.org.uk fore more informations about xPL project).
Face to the difficulties i encountered to build it, i sarted a "test project", that i linked you in the above messages.
I tried to build it from QtCreator.
I also tried to add
QT += core
to the project file, but it doesn't fix the problem.
Thank you very much for your replies.
Have a good evening ! :)
Hi again !
I just found my error !
I had to change :
CONFIG = staticlib
CONFIG += staticlib
And it performs the build correctly ! :)
Thanks for help
Ok, I see what your problem was.
CONFIG contains already a base set of values. Using = you emptied it thus removing qt from it so it would use it to build your library