Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

qmake -project -tp vc Project ERROR: Cannot run compiler 'g++'.



  • I want to make a .sln project that I can open and develop with Visual Studio (community 2019). The project build and runs fine in QT but when I run in my command prompt:
    qmake -project -tp vc
    this is the output I get:

    Project ERROR: Cannot run compiler 'g++'. Output:
    ===================
    Using built-in specs.
    COLLECT_GCC=g++
    COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe
    Target: mingw32
    Configured with: ../gcc-4.5.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-werror --build=mingw32 --prefix=/mingw
    Thread model: win32
    gcc version 4.5.2 (GCC)
    COLLECT_GCC_OPTIONS='-fno-keep-inline-dllexport' '-E' '-v' '-shared-libgcc' '-mtune=i386' '-march=i386'
     c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/cc1plus.exe -E -quiet -v -iprefix c:\mingw\bin\../lib/gcc/mingw32/4.5.2/ - -mtune=i386 -march=i386 -fno-keep-inline-dllexport
    cc1plus.exe: error: unrecognized command line option "-fno-keep-inline-dllexport"
    ignoring nonexistent directory "c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../mingw32/include"
    ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/include/c++"
    ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/include/c++/mingw32"
    ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/include/c++/backward"
    ignoring nonexistent directory "/mingw/include"
    ignoring duplicate directory "c:/mingw/lib/gcc/../../include"
    ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/include"
    ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/include-fixed"
    ignoring nonexistent directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/../../../../mingw32/include"
    ignoring nonexistent directory "/mingw/include"
    #include "..." search starts here:
    #include <...> search starts here:
     c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++
     c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++/mingw32
     c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++/backward
     c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include
     c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include
     c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include-fixed
    End of search list.
    ===================
    Maybe you forgot to setup the environment?
    

    The project is pretty much just a copy and paste of the widget application example project.
    Any guidance would be appreciated, thank you!


  • Lifetime Qt Champion

    @ellaine You should make sure qmake you're calling is the one from Visua Studio Qt, not MinGW Qt. Use an absolute path.


Log in to reply