Qt Creator 2.1.0 QT_NO_DYNAMIC_CAST define error
-
I had an error on MSVC2008 about an error with RTTI, I fixed it by removing the QT_NO_DYNAMIC_CAST preprocessor directive that was being added by the VS addin.
Now, I have the same problem with Qt Creator, now I see that maybe it's an issue with MSVC2008 and Qt 4.7.2, but in the meantime, how do I remove the QT_NO_DYNAMIC_CAST directive from my project?
I did a search on Qt Creator, and it appears this result:
<configuration> (1)
44 #define QT_NO_DYNAMIC_CAST 1Now, when I click on that result, it pops up "cannot open file <configuration>!", so what does that mean? apparently Qt Creator finds a result in some file, in line 44 that defines QT_NO_DYNAMIC_CAST to 1, but it can't show me where? how do I fix that? the only way for me to work right now is using VS2008 which I really don't like working with.
Can somebody please help me with this? thanks!
-
Yeah, I built it myself because I also wanted to have openSSL, mysql and webkit, but if I use my build with QtCreator 2.1.0 RC1 it works, but if I use it with the final release, then it breaks.
What I'm assuming is that the release version somewhere is setting the QT_NO_DYNAMIC_CAST directive on my project build, but on RC1 I don't have that problem.
Maybe someone can tell me if there's a workaround to this, or if there's some special configuration I can add or remove to my Qt project so my build doesn't break.
I even tried adding #undefine QT_NO_DYNAMIC_CAST everywhere, but still my build breaks.
I know my build works because if I use VS2008 and the Qt Addin, when I opened the project, the preprocessor configuration of my VS project had the flag QT_NO_DYNAMIC_CAST defined, I removed it and everything builds, but I want to use QtCreator, so I'm trying to find out how to make it work.
-
I just checked my files after I do a clean / make / build with Qt Creator 2.1.0 final, and looking at the Makefile that it generates, for both Makefile.Debug and Makefile.Release, it sets the defines line like this:
DEFINES = -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NO_DYNAMIC_CAST\
What's breaking my build is -DQT_NO_DYNAMIC_CAST, but my .pro file has no DEFINES at all, so all of that is being added by QtCreator. on VS2008 I can control the defines I want to add or remove, but on Qt Creator I don't see where I can do that, and just to see if I could control it from the .pro file, I tried something like:
DEFINES -= QT_NO_DYNAMIC_CAST
but still gets added, do you think it's a bug in Qt Creator 2.1.0 final? RC1 didn't do that to me
-
Ok, I fixed this by adding this line to my .pro file:
CONFIG += rtti
The strange thing here is that I don't need to add that configuration to RC1, but for final I need to add that.
Well, I guess it's fixed now, but it would be good if any of you Qt veterans could point me to some tutorials or more complete and comprehensive documentation to qmake files (.pro files) because it was quite difficult for me to find out about that config, I saw it by searching rtti on all Qt folders (found it in \mkspecs\features\win32\rtti_off.prf) so, if you could point me somewhere, I would be really thankful
-
Qt Creator does not add arguments to the Makefiles. It just calls qmake. You can add arguments to the qmake call in the project settings, the majority of the DEFINES come from the mkspec files and depend on the configuration settings of Qt itself.
I'll have a look into the VS2008 installation when I'm back in the office tomorrow and check if it's compiled with RTTI on or off by default.
In the meantime you can try to add to your .pro file:
@
CONFIG += rtti
@ -
Thanks!
hehehe rtti: I said it first! ;)
look, here's my configure command for building Qt:
configure -platform win32-msvc2008 -debug-and-release -opensource -fast -exceptions -no-dsp -no-vcproj -stl -qt-sql-sqlite -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -plugin-manifests -qmake -rtti -phonon -multimedia -webkit -script -scripttools -declarative -declarative-debug -arch windows -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -qt-style-plastique -qt-style-cleanlooks -qt-style-motif -qt-style-cde -qt-sql-mysql -I C:\MYSQL\5.1.50\include -L C:\MYSQL\5.1.50\LIB\OPT -no-qt3support -openssl -I C:\OPENSSL\INCLUDE -L C:\OPENSSL\LIB
Yeah, I know that I flagged some values that are by default, but I just added them just in case if I need to build it on mac or something else where I'm not sure if they are on by default. Maybe that's a qmake bug that if you specify a flag that it's on by default, it's built but not detected correctly or something.
just in case, I added stl and exceptions to the CONFIG directive on my qmake file because I saw those were disabled as well on my project Makefile generated by qmake.
It's odd that if I enabled them on my configure, that qmake doesn't detects it and that I have to manually enable it.
Then it's not a Qt Creator bug I guess, it's more of a qmake thing
-
I had the same problem and finally got a solution to it.
I have both commercial and opensource version of Qt 4.7.3 on my PC.
I compiled the commercial version by myself using such the follow command:
configure -debug-and-release -platform win32-msvc2010 -commercial -fast -nomake examples -nomake demos
the opensource version is already compiled.I tried to build my project but the QT_NO_DYNAMIC_CAST flag in Makefile breaks it. However it works fine when i build it with the opensource version.
At first thought it was a problem of qmake.exe because i copied the qmake.exe from the opensource version into the commercial version and it worked just ok!
I tried to recompile qmake.exe and failed.
finally i compared all the content between the two version and find a file named qconfig.pri in /mkspecs/.
i copied it into the commercial version and the problem's gone.the file content is as below:
CONFIG+= debug shared stl exceptions rtti mmx sse sse2
QT_ARCH = windows
QT_EDITION = FullFramework
QT_CONFIG += release debug zlib png accessibility qt3support opengl s60 ipv6 script scripttools xmlpatterns multimedia audio-backend declarative native-gestures svg minimal-config small-config medium-config large-config full-config
#versioning
QT_VERSION = 4.7.3
QT_MAJOR_VERSION = 4
QT_MINOR_VERSION = 7
QT_PATCH_VERSION = 3
#Qt for Windows CE c-runtime deployment
QT_CE_C_RUNTIME = no
#Qt for Symbian FPU settingsHope this will help anyone who has the same problem.