I want to include boost in my qt application in windows, So:
In my .pro file, I add:
INCLUDEPATH += D:/library/boost_1_55_0
In main.cpp
#include <boost/thread/mutex.hpp>
When build, cause this error:
Cannot open include file: 'boost/thread/mutex.hpp'
I am sure the path is correct. And it is very strange.
The issue is that you have to re-run qmake explicitly. Here you can find the corresponding long-standing issue:
Creator should know when to rerun qmake
Related
I'm migrating a project to Qt5, and I'm getting this error (it compiles fine for Qt4):
fatal error C1083: Cannot open include file: 'qtconcurrentexception.h': No such file or directory
for this line:
#include <qtconcurrentexception.h>
I include this file in order to use QtConcurrent::Exception. Has the header file for QtConcurrent::Exception changed?
All of the below applies to Qt 5 only.
If you ever need an include of the form <QtModule/QHeader>, it means that you did not add the relevant Qt module to your project file. You will get linking errors later, even though such hacked include seems to work during compilation.
QtConcurrent::Exception is deprecated and simply forwards to QException from the core module. So:
#include <QException>
If you wish to use the concurrent module for something else in Qt 5, you should #include <QtConcurrent>. You should also add Qt += concurrent to your project file, and re-run qmake.
I downloaded pre-built win32 poppler binaries from this page. Added the path for the include folder and lib folder in the .pro file:
INCLUDEPATH += "C:\\test_folder\\poppler-0.24.5-win32\\include\\poppler-qt5"
LIBS += -L/"C:\\test_folder\\poppler-0.24.5-win32\\lib"
In main.cpp i include "poppler-qt5.h" without errors, so I would think that poppler was added correctly. However when testing it by opening a pdf file, as described here,
QString path = "C:\\Windows\\System32\\spool\\PRINTERS\\test_file.pdf";
Poppler::Document *doc = Poppler::Document::load(path);
I receive a linker error:
Can someone help me out here?
I am missing the -l in yout LIBS line
LIBS += -L/"C:\\test_folder\\poppler-0.24.5-win32\\lib" -lpoppler-qt5
Eventually rename the lib since .dll.a is not a standard extension in windows.
Edit: Works without renaming the library:
.pro File:
INCLUDEPATH += $$quote(D:\Users\username\Downloads\poppler-0.24.5-win32\poppler-0.24.5-win32\include\poppler-qt5)
LIBS += -L$$quote(D:\Users\username\Downloads\poppler-0.24.5-win32\poppler-0.24.5-win32\lib) -lpoppler-qt5
.cpp File:
#include <QApplication>
#include <mycpp.h>
#include <poppler-qt5.h>
/* Some Code here */
QString path = "D:\\SomePDF.pdf";
Poppler::Document *doc = Poppler::Document::load(path);
/* More Code here */
I had the same problem and I resolved it with this method:
Copy dll file if you find in folder \poppler-0.24.5-win32\bin\ to folder where Qt generate executable file. Then download zlib1.dll and insert this dll to folder where Qt generate executable file. Try now.
This works for me. I compiled with qt 5.3 in Windows XP SP3.
i try to use yaml-cpp in cmake with windows 7
I followed the tutorial and build the cmake and get yaml-cpp.dll , yaml-cpp.lib , yaml-cpp.exp
i saved them inside the libs directory in my project.
with
LIBS += -L$$PWD/libs -lyaml-cpp
i add in in my pro file. The include files are added with
INCLUDEPATH +=$$PWD\includes
inside this is my yaml-cpp directory with all include files.
On my program I use
#include <yaml-cpp/yaml.h>
This all is compiling without an error. But when I add
YAML::Node doc;
i get the undefiened reference to Yaml::Node ERROR
i dont know what i have forgot to link.
Do you have an idea? thank you for help
I am trying to include QtSvg in mainwindow.cpp but when I compile it says cannot open include files: QtSvg. I have already added this(QT += svg) in my *.pro file. May I know what could be the problem?
After "pro" file change, it is necessary to launch qmake. After that it is possible to compile application.
I'm trying to create an Glut window with Qt creator. All my code has been done on another computer. Now, I want to compile it on my own.
I've added the Glut32 library files in the following folders:
glut32.lib into a lib/ foler in my project directory
glut32.dll into my project directory
glut.h into a GL/ folder in my project directory
In my pro files, I've added the following lines:
LIBS += -L$$PWD/lib/glut32.lib
LIBS += Opengl32.lib
And in my code, I've the following includes:
#include <gl/GL.h>
#include "GL/glut.h"
Qt does not report any error with the last include!
So, when I try to compile my code, I've many errors which say:
error LNK2019: unresolved external symbol
All those errors belongs to glut functions which cannot be found. So, did I do something wrong when I included the glut32 library?
Thanks.
Maybe it helps you to know, that you can output messages in your pro file, eg: message("Location of glut32.lib" + $$PWD/lib/glut32.lib). So you could check, whether your path is ok. Also note, that you add libraries with -l<LibName> and library paths with -L<LibPath>, so you should try to replace -L$$PWD/lib/glut32.lib by -l$$PWD/lib/glut32.lib
For further options refer to the qmake variable reference