Results 1 to 3 of 3

Thread: Using Qt 5.7 with MSVC compiler

  1. #1
    Join Date
    Jan 2015
    Posts
    15
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Using Qt 5.7 with MSVC compiler

    Hi all, hope this is the right place to post my issue.
    From several days, i'm trying to compile my project with the new Qt 5.7 library on Windows 10.
    Before(Qt 5.5), i was using Mingw(still on Windows 10) and everyting was going fine.
    The problem is that in this project i need to use qtwebkit so i ported everything to qtwebengine.(qtwebkit seems to be replaced by qtwebengine http://doc.qt.io/qt-5/qtwebengine-overview.html)
    Unfortunately, Mingw does not support qtwebengine, so i had to download and use MSVC compiler from Visual Studio.
    Now everytime i try to compile with MSVC2013 compiler i get this error:

    C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(147) : fatal error C1189: #error : "No Target Architecture"

    and the compiler point me inside the file winnt.h:

    Qt Code:
    1. #elif !defined(RC_INVOKED)
    2. #error "No Target Architecture"
    3. #endif
    To copy to clipboard, switch view to plain text mode 

    what i'm doing wrong?

    Thanks to all.

  2. #2
    Join Date
    Sep 2010
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using Qt 5.7 with MSVC compiler

    I know this is very old, but I ran into the same problem and could not find a solution online, so I'm hopefully going to save someone else the trouble in the future.

    The problem is that you are missing either "_x86_" (for 32 bit) or "_AMD64" (for 64 bit) in your "DEFINES" variable. Additionally, in my case I ended up having to remove a few extra defines that Qt put in automatically. Here's how I fixed this issue in my .pro file:

    Qt Code:
    1. DEFINES += _AMD64_
    2. DEFINES -= WIN32 WIN64
    To copy to clipboard, switch view to plain text mode 

    Hope this helps.

  3. #3
    Join Date
    Oct 2024
    Posts
    1
    Qt products
    Platforms
    Windows

    Default Re: Using Qt 5.7 with MSVC compiler

    The error you're encountering, "No Target Architecture," occurs because the compiler isn't detecting a target architecture for the build. Here’s what you can try to fix it:

    Verify the correct MSVC compiler is selected: Ensure you have selected a 32-bit or 64-bit architecture for MSVC in Qt Creator by choosing the proper kit in the build settings (x86 for 32-bit or x64 for 64-bit).

    Install necessary SDKs: Make sure you have the correct Windows SDK installed. The error points to missing or incompatible SDK files. You may need to install the Windows 8.1 or Windows 10 SDK from the Visual Studio installer.
    Update your environment variables: Ensure your development environment (Qt Creator) is properly configured with the correct environment variables for the MSVC toolchain.

    Use the correct MSVC version: Since you mentioned MSVC2013, ensure you are using Qt compiled with the same MSVC version. If you're using a newer Qt version (like 5.7), try upgrading your compiler to MSVC2015 or later, as older compilers might not work well with newer Qt libraries.

    By verifying these configurations, you should be able to resolve the issue and successfully compile your project.
    Last edited by OmarDay; 3rd October 2024 at 13:00.

Similar Threads

  1. Replies: 0
    Last Post: 10th June 2013, 01:54
  2. Configure Qcreator whit MSVC 2008 compiler
    By Ricardo_arg in forum Qt Programming
    Replies: 0
    Last Post: 27th August 2012, 15:23
  3. Replies: 8
    Last Post: 16th February 2011, 05:16
  4. msvc Compiler or mingw compiler
    By Ashutosh2k1 in forum Qt Programming
    Replies: 3
    Last Post: 14th February 2011, 08:33
  5. how to set QT Creator to use MSVC++ compiler instead of mingw
    By hcetiner in forum Installation and Deployment
    Replies: 5
    Last Post: 28th March 2010, 19:55

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.