Important: Please read the Qt Code of Conduct -

Qt 4.7.2 and VS2008 qglobal.h error

  • I just downloaded and built the 4.7.2 release of Qt and Qt Creator 2.1.0 final. I have MSVS2008 professional and used this configure settings:

    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

    Everything built fine in 4.7.2 just as It did with 4.7.1, I used the same configure parameters for 4.7.1 and had no issues whatsoever.

    I decided to give Qt Creator 2.1.0 a chance, but after I build a small test project I have, I got this warnings and errors:

    Warning 32 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc c:\Program Files\Microsoft Visual Studio 9.0\VC\include\xlocale 342

    ../../src/corelib/global/qglobal.h(2388) : error C2825: 'T': must be a class or namespace when followed by '::'

    As I got these issues on a project I used before with 4.7.1 and MSVC2008 pro, I decided to switch from creator 2.1.0 to MSVC2008 to see what was going on.

    Apparently, something happened with the Qt VS addin that disabled the "C++ Exceptions" option on my project settings, and I had to enable it (weird, really), but the error line is this one:

    { return T::dynamic_cast_will_always_fail_because_rtti_is_disabled; }

    somehow two things happened, the compiler is no longer recognizing C++ templates (maybe some MSVC obscure option got disabled like the C++ exceptions which is odd since I didn't make any changes to the project configuration) and the error is on the rtti_is_disabled macro, which I specifically built with Qt using -rtti just like 4.7.1 which worked fine, and also, I checked the compiler settings and rtti is in fact enabled.

    And now, the worst part is, I changed my Qt Folder env variable from \4.7.2 to \4.7.1, and now I get the same errors on 4.7.1 which didn't happened before, and now ALL of my Qt projects aren't building!

    Has anyone had this issue before? please help

    Can somebody please help me?

  • Update:

    I just found out a couple of issues, I don't know if this happened because I installed Qt Creator 2.1.0, or if it's some problem between the VS addin and Qt 4.7.2. but in case something like this happens to someone else, please check for this issues:

    On VS2008 Pro, go to Project -> Properties menu and check for the following:

    Configuration Properties -> C/C++ -> General : that your additional includes aren't messed up, the Addin added the ActiveQt libraries to Qt Configuration and the libs in that path, when I never enabled them, or haven't even used them in my life.

    Configuration Properties -> C/C++ -> Preprocessor : that your preprocessor directives are correct, somehow the directive QT_NO_DYNAMIC_CAST got added and caused my build to crash, because I built Qt with the -rtti flag and enabled the rtti on my project in Configuration Properties -> C/C++ -> language -> Enable Runtime Type Info = Yes

    Configuration Properties -> C/C++ -> Command Line : that your Additional options for your compiler are correct, I really don't add any extra options to the compiler, but somehow there where 3 extra options added there (-Zm200 -w34100 -w34189), I don't know if they where added by the Addin or not.

    I was able to get my project going again with these fixes, but still, I'm gonna try to find out if there are some issues being introduced to the project when I open it from Qt Creator 2.1.0 as well, because even though I reconfigured VS2008, I still get this errors in Qt Creator.

    --- EDIT: ---

    I can now confirm that these problems where introduced by the Addin, I added in Qt -> Qt Options the new Qt folder (4.7.2) and when I change the Qt version on my project from 4.7.1 to 4.7.2, the Addin messes up all of my includes, libraries, preprocessor directives, etc. So if someone uses the plugin, use the steps above because those are the settings that get messed up.

    I only have to see how to add all of the MSVC options mentioned above to Qt Creator 2.1.0 so that I can also build my app in there as well.

Log in to reply