Qt 5 and C++11 (qobjectdefs_impl.h won't compile) - qt

NB: I have tried asking this question here (on the Qt Project forums), but to no avail for the moment, so I'm trying my luck here.
I’m using Qt 5.0.1 (on a laptop with Ubuntu 13.04), the compiler is gcc 4.7.3 (and I'm working with Qt Creator 2.7.0).
In order to have C++11 working, it seems that simply adding the following line to the .pro file of the project does the trick (or at least it's supposed to):
CONFIG += c++11
However, when I do that, I get a ton of errors in the file qobjectdefs_impl.h upon compilation.
Anyone know how to fix this problem? Thanks in advance!
Edit: Here is a screenshot so that you can see what the errors look like (apparently the errors happen when I do #include <QColor>):
NB: link to the image if it shows too small here.
Edit: I still have the errors after having upgraded to gcc 4.8.1 and Qt 5.1.2, which I compiled from the sources.

Yay, someone (JKSH) found what the problem was on Qt Project forums (here).
In short:
The problem was that I had written somewhere #define I complex(0.0, 1.0), which created a name clash in qobjectdefs_impl.h (where complex was a typedef for std::complex<double>). For some (weird) reason that didn’t cause any problems as long as I didn’t write CONFIG = c+11 in the pro file, but not it did after writing it.
Many thanks to JKSH, and also Greenflow for helping!
Edit: The credit for finding the issue should go to Thiago Macieira from the Qt Project Interest mailing list, see comment.

Related

Cannot find feature windows_vulkan_sdk in qt

I have newly installed Qt and when I tried to open my projects and have not even tried to compile, I got this mysterious cannot find feature windows_vulkan.
My QT has been working earlier but I had to reinstall it because it complained I had missing libicuun65.dll and libicuuc65.dll and recommended reinstallation. I have removed everything and installed qt from scratch.
Below is my error
I went into the directory it specified and clearly see the file. I am just not sure the content of the file is complete as it only contains 2 lines below:
load(windows_vulkan_sdk)
QMAKE_LIBS_VULKAN =
Maybe there are lib that are missing like libicuun65.dll and libicuuc65.dll and/or others?
Also, please note the uncompleted "Prepare C++ code Model" status bar. It has never completed as I saw it there for hours...it should not take that long.
What should I do to rectify this issue? Please help.
Update: My paths are set up too...
I think I understand why this happens for you, you install your Qt in Drive D but install Vulkan SDK in Drive C.
These should be on the same Drive.
Maybe Qt can't find your Vulkan SDK because of that please reinstall Vulkan SDK in Drive D.
another thing is this link in bugreports.qt.io
and also this GitHub issue.
They have problems like you and their compiler was MSYS2.
In
\msys64\mingw32\qt5-static\share\qt5\mkspecs\common\windows-vulkan.conf
changed:
From: load(windows_vulkan_sdk)
To: load(win32/windows_vulkan_sdk)

How to use QtCopyDialog?

I include this library:
#include <QtCopyDialog>
When i compile, i see this error
"QtCopyDialog: No such file or directory"
How to solve this problem?
Thanks.
QtCopyDialog is not part of the core Qt library, but was released as part of Qt Solutions, a now discontinued add-on. The official Qt site links to a newish Git repository containing a few of the original Qt Solutions classes. This appears to be the most (only?) maintained location for the Qt Solutions source, but QtCopyDialog appears not to have made the grade. The only place I can find the source for QtCopyDialog is here. Judging from the docs, the last time it was maintained was pre Qt 4.5. You might need to make some changes in order to get it to work with whatever version of the Qt libs you're using.

Adding Qt Sources to QtCreator 2.4.1

I am currently using QtCreator 2.4.1 with Qt 4.7.4 development libraries (in Ubuntu) and am trying to track down a bug which after profiling with valgrind seems to occur internally within QGraphicsView::paintEvent(…) method
To help isolate this problem I would like to step into the Qt sources. Having done some searching through both the Qt forums and stack overflow and have not being able to find a way to integrate the sources with my version of QtCreator.
I have currently tried downloading the sources via the QtSDK manager and adding a “Source Path Mapping” within Tools->Options->Debugger. I am sure that this step is where I am making a mistake as I am unable to even switch to source when viewing internal Qt header files i.e. from QGraphicsView.h
I have so far tried adding the following Source Path Mappings
Source Path=/var/tmp/qt-src
TargetPath=/home/paul/QtSDK/QtSources/4.7.4
and
Source Path=/var/tmp/qt-src
TargetPath=/home/paul/QtSDK/QtSources/4.7.4/src
Neither works.
I have also tried building Qt directly from source, adding this to my "Qt versions" list within Qt Creator and creating a new project configuration using this version. This also did not work.
Likewise I have tried adding the src folders to my gdbinit file. This also fails to work.
I am completely lost with this.
Paul
Someone asked a similar question here: Need to step into Qt sources (my IDE is Qt Creator).
Someone else asked about Valgrind errors with Qt here: Suppression files for Qt memory leaks with Valgrind
And here is a little more info about Using Valgrind with Qt Creator along with some explanation about how to read the results. Its a little dated from late 2010.
Related Suggestions
I wouldn't debug the QGraphicsView class just because of all the effort to make it work or find the problem might be for nothing... Qt is moving to using the SceneGraph as the backend for QML and the rendering engine for QGraphicsView might become obsolete.
Updating to the latest stable build of the Qt libraries may make a big difference for QGraphicsView.
If you post the valgrind error you are getting to the Qt Trolls, someone might be able to explain what is going on for you.
There are other debugging techniques besides the traditional debugger. I've been programming in Qt in Windows (without valgrind) and with a large multi-threaded application, that loads a bunch of Dll's. I've had to put some faith into the Object Tree Model clean up and work on all the new calls I put in. Most of the time I just use QDebug to find errors. Then I am also using a combination of qInstallMessageHandler() with QDebug to implement decent logging for the hard to track bugs.
See also Qt Debugging Techniques.

Making an unsigned sis - error: No rule to make target `unsigned_sis'. Stop

I'm trying to make an unsigned sis package of my application, however I get the aforementioned error from QtCreator.
What am I doing wrong?
Best regards
I've got the same problem with Qt 4.6.3. Qt 4.7.3 creates unsigned .sis files without any issues, but 4.6.x doesn't. If the version of Qt isn't important for you, upgrade to 4.7.
I'm looking for another way to solve this, because I want to support old devices that don't work with Qt 4.7
UPD:
I found two ways to create unsigned sis:
Create a signed sis file with QtCreator and remove signature with Syscontents tool
Copy template .pkg, edit it a bit and create sis with makesis commandline tool.
I used the second way, because I use localized installation file. Localized installations work bad in Qt 4.6.3 out of box, so I had to create custom .pkg file
You can't install unsigned application to the phone. Try to sign it and see if it works better

Problem installing QT on Vista

I have downloaded QT SDK LGLP (Creator + libraries) 4.6 and I am having problems compiling projects. After install I have added C:\Qt\2010.02\qt;C:\Qt\2010.02\qt\bin to PATH and added QTDIR env varaible containing C:\Qt\2010.02\qt, the I run "configure -platform win32-g++" to compile it. Everything went good.
I the tried to use QT Creator to create and compile a project.
The problem is everytime I try to compile I get the following error message:
No valid Qt version set. Set one in Tools/Options
Error while building project GUITest
When executing build step 'QMake'
Canceled build.
When I go to Tools/Options the manual version is set to v4.6.2, Location c:\qt\2010.02\qt\bin\qmake.exe. The auto detected version is set to even though I have added the dirs in Path. Is there something I am doing wrong here? Has anyone encountered this problem in Vista.
I have been working on this for 2 days, change configurations, reinstalled etc...
The QtDir value is compiled into the
qmake-binary. You can only change this
by recompiling qmake and passing on a
different value to qt-configure (I'm
not sure which setting or variable is
passed on to qmake) When using
precompiled, downloaded binaries,
you'll have to keep the QtDir at
c:\Qt\4.6.2
EDIT:
What I said was incorrect. The locations of qmake, moc,... are located in the file:
<Qt>/4.x.x/.qmake.cache
Try uninstalling/reinstalling qt creator
But i highly suspect you didnt compile qt properly as this problem seems really odd. I had alot of problems compiling so i know myself from the past mistakes.
Make sure you carefully reread install instructions for your environment, also if you have visual studio you need to follow procedure to install it in compliance with it. Same if you use another c compiler
If nothing goes right, the easiest way to install qt imo is directy from their git hub, chec installin qt from git, on their git site there is wiki that explains how to do it
its really easy and after that all you need to do is add the qt to creator
Hey, it QT emulators have lot of problems in vista, i have tried several times,it didnt work for me.. it works well with windows XP. though ill tell you in brief what you need to do
1)install latest perl
2)install carbide c++ editor
3)install Qt SDK
4)install s60 or N97 emulators
make sure that except perl all the items which are mentioned above will be in same drive,and also
make sure that folder names which you give while installation should not have spaces at all..
i.e suppose if you are going to place any of the above items in a folder whose name is having spaces it will not work.
if you have any doubts feel free to ask.

Resources