Qt Creator - Boost include file not found - qt

I'm using Qt Creator 4.0.3.
I have set Boost header files root path in my Qt project file (.pro) like this:
INCLUDEPATH += C:/devel/boost/1_66_0_msvc2015/include
But I get this compilation error:
C1083: Cannot open include file: 'boost/variant.hpp': No such file or directory

Solved by launching "qmake" before compiling...

Related

Qt creator: include path for external lib not found

I'm trying to add net-snmp lib to my project using win7 + cygwin:
Project file seems to contain valid lib and path entries:
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/C:/usr/lib/
-lnetsnmp else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/C:/usr/lib/ -lnetsnmpd
INCLUDEPATH += $$PWD/C:/usr/include DEPENDPATH += $$PWD/C:/usr/include
But I can't build the project, because include file is not found, also it exists under given directory physically (c:/usr/include/net-snmp/net-snmp-config.h)
../snmptest1221313123/main.cpp:1:38: fatal error: net-snmp/net-snmp-config.h: No such file or directory
#include
I've read all "add external lib" topics, but it doesn't help to solve this.
Re-running qmake, re-opening Qt creator, or running qmake -r from terminal doesn't help neither.
Remove $$PWD/ (both from include and libs) and try again: run qmake and rebuild.

Compile error in Qt/C++

I am trying to compile an example from a library.
I have Qt installed but I think I have to link it and I don't know how.
This is the error:
g++ face_recognition.cpp -o test
In file included from face_recognition.cpp:29:0:
/usr/local/include/openbr/openbr_plugin.h:22:23: fatal error: QDataStream: No such file or directory
#include <QDataStream>
^
compilation terminated.
You can't compile a Qt application directly with g++ because the application must first go through Qt's moc compiler.
If you want to build a Qt application from the cmd-line, make sure you define an appropriate .pro file that specifies the Qt modules and other 3rd party headers/libraries you want might to use. For instance:
QT += core widgets
SOURCES += \
main.cpp
Then invoke qmake on the command line in the same directory as the .pro file to build the appropriate Makefiles, and finally execute make to build the app.

Qt Cannot open include file: 'QPrinter'

I am new to Qt. Downloaded source code for a Qt application of SourceForge, and tried to build and run it. After working through a few similar problems by adding QT += statements to .pro files, I am stuck on this one:
On attempting to build in Qt Creator, I get errors saying
error: C1083: Cannot open include file: 'QPrinter': No such file or directory
I tried adding QT += printsupport to the .pro file, cleaning, and rebuilding, but that gives this error
Error: dependent '..\..\..\..\..\..\..\..\..\..\..\Qt\Qt5.1.1\5.1.1\msvc2012_64\include\QtPrintSupport\qtprintsupportglobal.h' does not exist."
When I go to C:\Qt\Qt5.1.1\5.1.1\msvc2012_64\include\QtPrintSupport, qtprintsupportglobal.h IS THERE!
You have to add QPrinter Support to your project's .pro file:
QT += printsupport
In my case the solution was to
Delete the shadow build directory and build again
after adding printsupport, as #KubaOber suggests in the comments.
Easy mistake to make: After you edit your .pro
QT += printsupport
You have to SAVE the file before your .h will be aware of it.
Because QMake will eventually be dropped in favor of CMake, here's the solution for CMake users:
Pass PrintSupport to the find_package call, to the right side of COMPONENTS, like in this example:
find_package(Qt5 ${QT5_MIN_VERSION} REQUIRED COMPONENTS Core Gui Qml QuickControls2 PrintSupport)

Adding QtLua to a QtCreator project

Well i have a folder called libqtlua-1.4 in which i have the libqtlua.so, the qtlua executable, and in libqtlua-1.4/src/QtLua i have the headers.
How can i include it in a qtcreator project?
(I am running in ubuntu 11.10)
Any suggestion would be appreciated.
You have to specify the library in you project file (file with .pro extension) to qmake be able to see them when compile:
LIBS += -L/path/to/your/lib/libqtlua-1.4 -lqtlua
INCLUDEPATH += /path/to/your/lib/libqtlua-1.4/src/QtLua
References: LIBS, INCLUDEPATH.

How do i reference the qjson.dll file from my qt project?

How do I refernce the qjson.dll file from one of qt project?
For eg :C:\qjson-0.7.1\qjson\build\lib , in this location, I have qjson.dll and qjson.dll.a file. I want to use that dll from my qt project.How should I point to that location in that .pro file. I can't compile successful, the error that I got is
C:/QTTest/foo/foo/main.cpp:6: error: Qjson/parser.h: No such file or directory .Can someone can help me?
Thx.
First, you have to tell QMake in your .pro where is located your header files using the INCLUDEPATH variable (please correct the path to point the location of your Qjson folder):
INCLUDEPATH += "c:/qjson-0.7.1/include"
Second, you must specify your library and it's location using LIBS variable:
LIBS += "c:/qjson-0.7.1/qjson/build/lib/qjson.dll.a"
Now, QMake will find your header file and your library. You will need to have the qjson.dll in the same directory as your Qt application or to add it's location in your PATH environment variable.

Resources