issue of including QtGui files in building a c++ based software - c++

I am not expert in c++ and I am trying to install a software which is based on c++; during the building the files in Qt Creator, once it reaches to this line to include
#include <QtGui/QMainWindow>
#include <QtGui/QGraphicsSceneMouseEvent>
it shows error
/home/ubuntu/Ezys/source/Ezys_GUI/ezys_gui.h:12: error: QtGui/QMainWindow: No such file or directory
#include <QtGui/QMainWindow>
^
I checked the place of QtGui, which is /usr/include/qt4/QtGui and all files are there. I do not know what is the reason cannot find the files and include them.
Could someone please help me? Thanks

I think you're using the wrong kit for your project in Qt Creator, probably one based on Qt 5. See if you have a kit for Qt 4 or create a new one, then reconfigure your project to use it.

Related

QMediaPlayer, QSound class - unable to #Include files (files are there)

I have been trying to play a simple audio file using:
http://qt-project.org/doc/qt-5/qmediaplayer.html and
http://qt-project.org/doc/qt-5/QSound.html
I am using Qt 5.3 but the problem is, when I type #include QMediaPlayer or QSound, QtCreator keeps underlining them with red because it can't find them. The thing is, the files are there. They are located in QtMultimedia/ and I have seen them. When I try to prefix QtMultimedia/QMediaPlayer or QtMultimedia/qmediaplayer.h it still can't find them.
If I type #include "QtMultimedia/" the auto-complete drop down in the text editor only shows QtMultimedia/QtMultimediaDepends. Normally you get a list of all the files in the folder but not with this one.
Looks like there is something wrong with the paths. How do I fix them? I am using a Windows machine.
Edit: I have included project settings - see screenshots.
I think, after you modified your .pro file, You didn't run the qmake.
build-> run qmake
qmake will generate the makefile you need to build the src code.
if you only change the .pro file, but didn't run it. Nothing is changed.
and that is reason, you create a new project and it is working.
Ok I figured it out. It's a problem with my Qt version.
My Qt 5.3 version is a custom compiled one. When I select the included version that came with the installer, QSound is found. When I change the kit to the custom compiled one, the file cannot be found. I must have forgotten to include some sort of multimedia option to the configure script during compilation.
Now the question is what is the missing option, I will need to do more reading...
Of course, comments and suggestions are welcome :)
You have to add the word 'multimedia' in your .pro file:
QT += core GUI
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets multimedia

Linking Codeblock glut project with assimp library

Hello I am new with assimp and have a problem.
When I try to include the:
#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
in a c++ glut project it says No such file or directory, so I obviously need to link some libraries to the project. The question is where can I find that library.
I downloaded assimp view 3.0 and opened the object i need to inport in c++ with it and so far it look ok.
http://assimp.sourceforge.net/lib_html/usage.html .. Is the link to how to use assimp with c++ but no info how to link it
You should have read up on the very site you linked.
http://assimp.sourceforge.net/lib_html/install.html
These are installation directions. The very top looks like it talks about using prebuilt libraries and telling you what to link into your visual studio project.
One last note: you are using the c interface according to your question. After reading the documentation I see that they have a C++ specific importer header you may want to use instead.
#include <assimp/Importer.hpp>
EDIT: This answer assumes you are using visual studio of course. However, that link also provides building from scratch instructions as well as other ways of building and installing the library. So if you are a linux/unix user I imagine you can make do with these instructions.

Why can't I find <QTcpServer>?

My VS2010 can only #include <Qt/qtcpserver.h> but can't #include <QTcpServer>.
Qt assistant suggested <QTcpServer> be included to apply TCP server but it seems this header cannot be found by my VS2010, but it can find <Qt/qtcpserver.h> and these two headers seems to be the same.
Are they the same and why can't I find <QTcpServer> ?
PS:
I'm currently using Qt4 plugin with VS2010.
Here's a snapshot of my VS project files:
No .pro file there.
You need to have
QT += network
in your .pro file to get the Qt networking headers and library correctly set up for your project.
For the Qt Visual Studio Add-in, look at the second tab of the project settings dialog box.
In your Qt project settings, add the network module. A guide with pictures:
http://doc.qt.digia.com/vs-add-in/vs-addin-managing-projects.html

Qt4.7 -- "QtCore/QFile: No such file or directory"

I have to set up a Qt development environment for my GUI class. I am working through a tutorial and was instructed to include the <QTCore/QFile> header in my implementation file. However, I cannot build the project because the above header file is not found.
I am not sure what I am missing here -- I installed Qt-Creator and all of the deps from the Debian package manager (currently using Wheezy). The Qt 4.7 documentation in IDE also has a section on the above header files, and yet it can't seem to locate them... odd.
NOTE: Header should have read <QtCore/QFile>.
Just #include <QFile> will be more compatible with Qt5. Also note the capital T you have, it should have been #include <QtCore/QFile> - remember unix/linux file systems are case sensitive.
You looked at the library file, not the include files. Those are different things in C/C++.
As trojanfoe correctly mentioned - you are probably missing the development packages of Qt4.

OpenCV using Eclipse with CDT

I was always using QtCreator for OpenCV but a new project started with a friend needs to be done with eclipse.
I did all things I usually do with QtCreator but I am facing a strange problem. Although I did set the include path (/home/opencv/include) when I try to compile I get errors for missing headers (i.e opencv2/core/core.hpp). In the project explorer under include tag the only headers appear are the ones in the first level of the included directory. This means that cdt does not include headers recursively.
Is this a bug or I have to include every single directory?
I had the same problem yesterday. It searched all around forums but nobody could answer me. Finally I realized that I was doing the include for the whole project and including files for the project is not the same as including files for the source file "source.cpp" (for eclipse, because for VisualStudio it is the same).
So try to rightclick on the .cpp file and include the directories for it. Anyway, if you tell me which version of OpenCV you're using I can tell you more aspects of how to include files in case you keep having troubles.
I hope it helps. When you get errors about missing headers is always related to include. At least it happened to be like this in my case.
If the include path in Eclipse is /home/opencv/include , we assume that inside this directory you have 2 folders: opencv and opencv2.
On your source code you must reference the headers as:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
Does that makes sense to you?
Nevertheless, there are several tutorials that can help you configure Eclipse.
I had this problem, too. I think what you need to do is to include the path opencv/build/include, not opencv/include. That's where all the header files are.