Results 1 to 7 of 7

Thread: Can't compile with MSVC

  1. #1
    Join Date
    Apr 2016
    Posts
    4
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Can't compile with MSVC

    I download and install qt-opensource-windows-x86-msvc2010-5.5.1.exe, create new project (Qt Widgets application), build it (no changes to the project) and get this:

    Qt MSVC2010.jpg

    What is the problem and how to solve it?

    Windows 7, MSVC 2010 Professional is installed.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Can't compile with MSVC

    Make sure that in your project properties, "C++ -> Language -> Treat wchar_t as Built-in Type" is set to True. The default for new projects in VS 2008 (and I guess 2010) is to set that to False. Qt5 is built with the flag set to True. The mismatch causes all these obscure errors that you see.

  3. #3
    Join Date
    Apr 2016
    Posts
    4
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Can't compile with MSVC

    "Treat wchar_t as Built-in Type" is set to "Yes".
    But my problem is that Qt Creator can't compile with MSVC2010 compiler. Maybe there is some place where some similar option can be set?

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Can't compile with MSVC

    I suggest you fire up your browser and paste the "C2906..." (the first) error text into a Google search box and see what the links say about where this error comes from. The rest of the errors are probably just as a result of the first one, and if you fix that they will go away.

    But my problem is that Qt Creator can't compile with MSVC2010 compiler.
    Qt Creator can compile with any C++ compiler you configure as a "kit" - I use it on Windows with VS 2008, VS 2013, VS 2015, Android gcc, and minGW (see the screenshot). If you are trying to use Qt Creator to compile your project (and not the Visual Studio IDE), then you need to be sure that you are using the same compiler options in Qt Creator that you have set in the VS IDE. You do this in the .pro file for your project.

    Capture.jpg

  5. #5
    Join Date
    Apr 2016
    Posts
    4
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Can't compile with MSVC

    The most important compiler options seem to be the same, but why are they "unknown"?

    E:\Qt3\Qt5.5.1\Tools\QtCreator\bin\jom.exe -f Makefile.Release
    cl -c -nologo -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -w44996 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I..\eeee -I. -IE:\Qt3\Qt5.5.1\5.5\msvc2010\include -IE:\Qt3\Qt5.5.1\5.5\msvc2010\include\QtWidgets -IE:\Qt3\Qt5.5.1\5.5\msvc2010\include\QtGui -IE:\Qt3\Qt5.5.1\5.5\msvc2010\include\QtANGLE -IE:\Qt3\Qt5.5.1\5.5\msvc2010\include\QtCore -Irelease -I. -IE:\Qt3\Qt5.5.1\5.5\msvc2010\mkspecs\win32-msvc2010 -Forelease\ @C:\Users\qzmich\AppData\Local\Temp\main.obj.6428. 16.jom
    main.cpp
    Command line warning D4002 : ignoring unknown option '-Zc'
    Command line warning D4002 : ignoring unknown option '-Z:'
    Command line warning D4002 : ignoring unknown option '-Zw'
    Command line warning D4002 : ignoring unknown option '-Zc'
    Command line warning D4002 : ignoring unknown option '-Zh'
    Command line warning D4002 : ignoring unknown option '-Zr'
    Command line warning D4002 : ignoring unknown option '-Z_'
    Command line warning D4002 : ignoring unknown option '-Zt'
    Command line warning D4002 : ignoring unknown option '-w34100'
    Command line warning D4002 : ignoring unknown option '-w34189'
    Command line warning D4002 : ignoring unknown option '-w44996'

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Can't compile with MSVC

    No idea. It looks like cl is somehow taking apart the "-Zc:wchar_t" option character by character and trying to interpret each one as a separate option. They are only warnings, though. Does it compile?

  7. #7
    Join Date
    Apr 2016
    Posts
    4
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Can't compile with MSVC

    No, it doesn't. More than 100 errors, compiler stops.

Similar Threads

  1. compile errors qwtpolar 1.1.1 msvc 2012
    By TonyInSoMD in forum Qwt
    Replies: 2
    Last Post: 25th October 2016, 09:29
  2. Replies: 0
    Last Post: 25th June 2014, 04:37
  3. compile plugin with msvc??
    By tentakel in forum Qt Programming
    Replies: 6
    Last Post: 6th May 2010, 14:04
  4. Possible to compile Qt 4.5 source with msvc 2010 beta?
    By JimDaniel in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd July 2009, 14:19
  5. how to compile with msvc express 2008
    By john_god in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd March 2009, 14:09

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.