Using glut with QT after update - qt

I have a problem with update of my QT. I have decided to do an update from 5.2.1 to the newest, 5.8 version. Now I am trying to run my old project. There is something wrong with my graphic module, especially with functions connected with glut (I think so). I tried this week to solve this by myself, but now I am confused and tired.
Now I am using: Qt 5.8.0 for Windows 32-bit (MinGW 5.3.0).
Originally I had the following libs only in my .pro file, end it works in QT 5.2.1:
LIBS += -lglut
But now, in new version of QT, I am getting such errors:
Errors using the original project (with -lglut)
When I change:
LIBS += -lglut
Into:
LIBS += -lopengl32
I am getting only such errors:
Errors using -lopengl32
I do not know how to understand this "undefined reference". I see that glu.h is included in my project (as #include ). I can also see that "undefined" commands are recognized by the creator and glu.h is visible. I do not know how to solve this. Old QT 5.2.1. still is available in my computer and project successfully works. And also I have to tell You that I am not professional and I will be very grateful for any help and guidance.

Related

I cannot integrate Qt and VTK

I am trying to integrate VTK and Qt but unfortunately for some reasons I cannot. Currently, I can run VTK's examples except those using Qt's user interface. For example, examples in tutorial work but examples in infovis cannot be run.
I followed the guide on http://www.vtk.org/Wiki/VTK/Configure_and_Build. All parts were done successfully except :
cmake -DQT_QMAKE_EXECUTABLE:PATH=/path/to/qt-4.8.6-build/qt-everywhere-opensource-src-4.8.6/bin/qmake \
-DVTK_Group_Qt:BOOL=ON \
-DBUILD_SHARED_LIBRARIES:BOOL=ON \
/path/to/VTK
when I was in VTK-build directory, it said that there was no path/to/VTK. So, I changed to VTK and removed /path/to/VTK and it worked.
Whenever I tried to build an aforementioned example, Qt says :
cannot find -lQVTK
error: cannot find -lvtkRendering ....
I really appreciate any help you can provide.
If you have installed the VTK in a folder named, say, "VTK-install", then check if you have QVTK.lib in the VTK-install/lib/vtk-5.10/ folder. (your vtk version will be different though).
In the Qt Creator, you have to edit the pro file. This is what you have to add to the end of the pro file created in Qt creator.
INCLUDEPATH += C:\\VTK\\VTK-install\\include\\vtk-5.10
LIBS += -LC:\\VTK\\VTK-install\\lib\\vtk-5.10
LIBS += -lvtkCommon\
-lvtksys\
-lQVTK\
-lvtkViews\
-lvtkWidgets\
-lvtkInfovis\
-lvtkRendering\
-lvtkGraphics\
-lvtkImaging\
-lvtkIO\
-lvtkFiltering\
-lvtklibxml2\
-lvtkDICOMParser\
-lvtkpng\
-lvtkpng\
-lvtktiff\
-lvtkzlib\
-lvtkjpeg\
-lvtkalglib\
-lvtkexpat\
-lvtkverdict\
-lvtkmetaio\
-lvtkNetCDF\
-lvtksqlite\
-lvtkexoIIc\
-lvtkftgl\
-lvtkfreetype\
-lvtkHybrid\
And run it in release mode. This should work fine.
If this doesn't work, make sure you have installed Qt and VTK correctly. You can check out this tutorial on how you should install Qt with VTK in MS Visual Studio 2010.
Install Qt with VTK
Of course, after this you got to install Qt creator which is better than Visual Studio to work with Qt.

Creator still uses old compiler even though I've updated my kit

I had a kit set up in Qt Creator 3.0.1 that pointed to my cross toolchain. This worked until I ran into a bug in the compiler and now have to upgrade to a newer version.
I've obtained a newer toolchain. I went into Creator, edited my kit, and updated the path to the compiler and gdb binary to point to the new toolchain.
However, when I build my project, it's still calling the old toolchain's compiler.
I've even completely deleted my kit, compiler, and debugger and recreated their configuration, but no joy.
I double-checked the mkspec that is being used, and there is nothing in there with hardcoded paths to the compiler, just things like QMAKE_CXX = $${CROSS_COMPILE}g++. I don't have the CROSS_COMPILE variable set. I did try setting it (in Creator's build environment editor) but no joy there either.
How do I get Creator to use my new toolchain?
EDIT - NEW INFO
I tried running the same qmake command line Creator does when it builds (according to its build output). First, the call to qmake I'm making is returning to the command line without creating a makefile. Here is the command I'm running:
/qt5/bin/qmake /s/src/tfs/porject_dirs/Myproject.pro -r -spec devices/linux-am335x-g++ CONFIG+=declarative_debug CONFIG+=qml_debug
So, I added a -d to get some qmake debug output. I found some fishy lines that pointed to some files that are in my mkspecs directory.
What are these files that were installed when I built Qt?
qconfig.pri
qdevice.pri
qfeatures.pri
qmodules.pri
Three of the four (not qfeatures.pri) include in them hard coded paths to the compiler I used to build Qt. I suspect that these are my problem.
Why does Qt Creator allow a compiler to be specified if these files might be overriding it? Is it safe to edit these files? Do I have to rebuild Qt simply to change the compiler used to build my application?
There is, an open bug in Qt that leaves hardcoded paths in the .pri files mentioned in my question.
Update
The bug has been resolved.

Qt 5 Unknown module(s) in QT: uitools

I just started to use Qt today and I don't know if I did something wrong when I installed it but I can't use QFormBuilder.
Linux Xubuntu 64b
what I did:
I clone this repo : git#gitorious.org:qt/qt5.git
init_repository >> ./configure >> make >> sudo make install
I downloaded qt-creator http://qt-project.org/downloads#qt-creator
I created a new project and when I try to include QFormBuilder he tell me that he doesn't know this file.
So, I saw somewhere someone who says that I need to add QT += uitools to the project file, but now when I try to use qmake, I am getting Unknown module(s) in QT: uitools.
Sorry for my english and thank you for your help.
If you get
Project ERROR: Unknown module(s) in QT: designer
you are missing qttools5-dev package.
To add to the answer by #svlasov, on RHEL or CentOS based systems (7.x or 8.x, etc.) you need to install:
yum install qt5-qttools-devel
Depending on the project you are building, you may also need to install qt5-qttools-static.
Have you actually read the documentation?
It writes this at the beginning:
The QFormBuilder class is used to dynamically construct user interfaces from UI files at run-time. More...
Header: #include
qmake: QT += designer
Inherits: QAbstractFormBuilder.
So, just follow that and put this into your qmake project file:
QT += designer
or you can invoke qmake like this:
qmake QT += designer
Of course, you need to make sure that you have the designer installed properly for this. You will need to install a package like libqt5designer5 on your Ubuntu, or if you had installed Qt manually, you will need to install the designer manually as well.
I am not that familiar with Ubuntu. You may need to install some corresponding development package as well. Either way, the point is that the library and headers need to be installed properly on your system which you seem to lack when getting Project ERROR: Unknown module(s) in QT: designer after either of the aforementioned solutions.
Read the documentation, it says to add the designer module to the .pro file:
QT += designer

Qt 4.8.3 installation on Windows 7 & QtWebkit problems

I just updated my Qt to 4.8.3, because the program built from older version is not compatible to the new framework.
So I have to upgrade.
This process was frustrating and time consuming. So many problems came out.
I download Qt from this url:
http://qt-project.org/downloads
At beginning, I installed the MinGW one (I'm not a fan of MSVC).
I tried the newest ( I think it's 4.6) version of MinGW and order version (4.4).
However, after I installed MinGW and tried to install Qt 4.8.3, during the process, the following message shows up:
There is a problem with your MinGW installation:
The installer could not find a valid C:\MinGW\include\w32api.h (Only versions with W32API 3.13 are supported)
Do you still want to continue? (Your installation may not work)
The 4.6 version does have this w32api.h file, I don't know what's going on. And I have trouble finding MinGW 4.4 with this head file.
I decide to ignore this warning and continue to install Qt and Qt creator. After that,
I opened my current project, configure it (why the configuration become so complex...), I tried to build it.
Then the following message shows up because some external lib I used requires Exception Handling:
exception handling disabled, use -fexceptions to enable
And I don't know how to enable the it.
I tried to add -fexceptions flag in QMAKE_CXXFLAGS but it doesn't work.
By the way, I tried the VC version of Qt too, but I used the MinGW before and the VC compiler is quite different, if I use VC version, it will take a lot of time to make it compilable by VC compiler.
Does anyone know how to install Qt 4.8.3 on Windows? my project works fine before, now I just want to compile it successfully.......
These are not the only problem.
I updated the Qt on Mac machine too, it is easier to have the compiler work since it's unix base.
However, I used QtWebkit lib in my project and obviously, they changed this lib and it's not compatible to order version.
I can compile my project on Mac, however, every time I run it, following massage shows up and the program stopped.
dyld: Symbol not found: _OBJC_CLASS_$_CALayerHost Referenced from:
/Library/Frameworks/QtWebKit.framework/Versions/4/QtWebKit Expected
in:
/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore
The program has unexpectedly finished.
Does any one know how to solve this QtWebKit problem? I'll really appreciate.
I remembered that when Qt is under nokia, it's so easy to install and use, the Qt SDK is perfect.
I really hate the change made after it was bought by digia.........
I found solutions of my first two problems:
for the first problem, as I described, download the MinGW provided by Nokia Qt
ftp.qt.nokia.com/misc/MinGW-gcc440_1.zip [ftp.qt.nokia.com]
Tried several versions of MinGW 4.4, I think this is the only one works.
About the second problem, add following configure in the project file:
CONFIG += exceptions
Now the QWebKit problem is only one unsolved.
Is it all relevant that your include directory for MinGW has two "i's" in it or was that a typographic error when posted on SO? See:
The installer could not find a valid C:\MinGW\iinclude\w32api.h

Qt Creator 2.1.0 can't find Qt, looks in wrong place

I've recently installed 4.7.1 (and 4.7.2, same results) alongside QtCreator 2.1.0. When I try to compile the default (empty) QtGui application, I get 'QtGui/QApplication: No such file or directory' errors. If I and the file location to INCLUDEPATH in the .pro file, I get 'can't find -lQtGui'; if I add the library to LIBS, the program compiles and runs.
But modifying the .pro file like this really isn't a viable solution, it's very difficult for large programs for one thing, and in any case I can't believe this is what the developers intend. I've used various versions of Qt for several years now and have not had this problem.
According to the Makefile, Qt is looking for these files/libs in directories that don't exist, specifically ~/include and ~/lib ('/home/matt' is my home directory, on Ubuntu):
INCPATH = -I/usr/local/Trolltech/Qt-4.7.2/mkspecs/linux-g++-64 -I. -I/home/matt/include/QtCore -I/home/matt/include/QtGui -I/home/matt/include -I/usr/X11R6/include -I.moc/release-shared -I.uic/release-shared
LIBS = $(SUBLIBS) -L/home/matt/lib -L/usr/X11R6/lib64 -lQtGui -lQtCore
Why is it trying to look in these folders? I've tried changing the HOME and even PWD system environment variables, it didn't change anything. NB Qt and QtCreator are both installed in my home directory. Does anybody know what the issue is here?
Matt
P.S. I've had this on QtCentre for awhile but haven't heard anything there.
P.P.S I've gone ahead and filed a bug report, http://bugreports.qt-project.org/browse/QTBUG-18230
The LIBS variable in the Makefile must point to the directory from the QtCreator library directory as follows :
LIBS = $(SUBLIBS) ~/QtSDK/QtCreator/lib/qtcreator -lQtGui -lQtCore -lpthread
Then run : make
It's possible that Qt Creator hasn't detected where you installed the 4.7.x toolkits. Look in Tools->Options->Qt4 (on a Mac Preferences->Qt4) and add toolkit versions (the "+" button). What you need to identify are paths to qmake for whatever version you want to build.
http://bugreports.qt-project.org/browse/QTBUG-18230
Turns out .qmake.cache was out of date, deleting it solved the problem.

Resources