Results 1 to 2 of 2

Thread: Qt Cmake configuration has no path to a C++ compiler set.

  1. #1
    Join Date
    May 2017
    Qt products

    Default Qt Cmake configuration has no path to a C++ compiler set.

    The warning I get is: "Qt CMake configuration has no path to a C++ compiler set, even though the kit has a valid tool chain."

    I am not sure how to change the CMake configuration so that it has a path to the compiler.
    I do have a C++ compiler installed as it works with VS but Qt seems to run into some problem.

    This is a screen shot of what appears as the warning:

    This is the error I get trying to run anything:
    Qt Code:
    1. jom: C:\Users\User\Desktop\inv\build-Invaders-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug\Makefile.Debug [debug\game.obj] Error 1
    2. 'cl' is not recognized as an internal or external command,
    3. operable program or batch file.
    4. jom: C:\Users\User\Desktop\inv\build-Invaders-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug\Makefile.Debug [debug\spaceship.obj] Error 1
    5. 'cl' is not recognized as an internal or external command,
    6. operable program or batch file.
    7. jom: C:\Users\User\Desktop\inv\build-Invaders-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug\Makefile.Debug [debug\laserbeam.obj] Error 1
    8. 'cl' is not recognized as an internal or external command,
    9. operable program or batch file.
    10. 'cl' is not recognized as an internal or external command,
    11. operable program or batch file.
    12. jom: C:\Users\User\Desktop\inv\build-Invaders-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug\Makefile.Debug [debug\config.obj] Error 1
    13. jom: C:\Users\User\Desktop\inv\build-Invaders-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug\Makefile.Debug [debug\iofile.obj] Error 1
    14. jom: C:\Users\User\Desktop\inv\build-Invaders-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug\Makefile [debug] Error 2
    15. 17:06:30: The process "D:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.
    16. Error while building/deploying project Invaders (kit: Desktop Qt 5.8.0 MSVC2015_64bit)
    17. The kit Desktop Qt 5.8.0 MSVC2015_64bit has configuration issues which might be the root cause for this problem.
    18. When executing step "Make"
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 816 Times in 805 Posts
    Qt products
    Windows Android

    Default Re: Qt Cmake configuration has no path to a C++ compiler set.

    Run CMake from within a Visual Studio command prompt window: Windows Start Menu -> Programs -> Visual Studio 2015 -> Visual Studios Tools -> Windows Desktop Comand Prompts -> whatever is appropriate. These are just Windows BAT files that set up the environment paths and C++ compiler options to allow them to be called from the command line or programs like CMake.

    I have several BAT files the I link to from my Desktop that execute the appropriate VS BAT file and then CD to the directory where my CMake project lives. For example, this "BuildProject.BAT" file lives at the top level of my CMake project and is called with these command line arguments:

    Qt Code:
    1. C:\> BuildProject [clean] [Win32 | Win64] [Release | Debug]
    To copy to clipboard, switch view to plain text mode 

    where all arguments are optional. The project builds to an out-of-source directories ("build" and "install") that have subdirectories according to the bitness and build type.

    If you call it with no arguments, it will rebuild anything that has changed since the last build, except the CMake Makefiles.

    If you call it with the argument "clean", it will erase everything in the output directories and rebuild everything from scratch, including regenerating the Makefiles from the CMakeLists.txt inputs. It will build Win32 Release, Win32 Debug, Win64 Release, and Win64 Debug.

    If you call it this way:

    Qt Code:
    1. BuildProject foo Win32 Release
    To copy to clipboard, switch view to plain text mode 

    it won't clean (anything other than "clean" as the first argument works) and will build only the 32-bit Release version. You can put "foo" to substitute for any of the three arguments and it will perform the default:

    arg 1 = foo: no clean, just build
    arg 2 = foo: builds both 32- and 64 bit versions
    arg 3 = foo: builds both Release and Debug versions

    so you can have things like:
    Qt Code:
    1. BuildProject clean foo Release <-- cleans, then builds 32- and 64-bit Release versions
    2. BuildProject foo Win32 foo <-- builds 32-bit Release and Debug versions after source changes
    3. BuildProject clean Win64 Release <-- cleans, then builds only 64-bit Release version
    4. BuildProject foo foo foo <-- identical to BuildProject (with no arguments)
    To copy to clipboard, switch view to plain text mode 

    Here's the BuildProject.bat file. Note that it also has a variable (vsversion) that lets me customize it for the Visual Studio version I want to use:
    Qt Code:
    1. @echo off
    3. REM Clean, generate, and build Windows 32- and 64-bit debug and release
    4. REM versions of the project DLLs and executables
    6. REM Change for a different Visual Studio version. 12.0 = MSVC 2013, 14.0 = MSVC 2015, etc.
    7. set vsversion=12.0
    9. if "%1" == "clean" (
    10. echo -- Cleaning
    11. if EXIST install\libs\Windows rd /s /q install\libs\Windows
    12. if EXIST install\Include rd /s /q install\Include
    13. if EXIST build\Win32 rd /s /q build\Win32
    14. if EXIST build\Win64 rd /s /q build\Win64
    15. echo -- Cleaning done
    16. echo --
    17. )
    19. set bitness=Win32 Win64
    20. if "%2" == "Win32" (
    21. set bitness=Win32
    22. )
    24. if "%2" == "Win64" (
    25. set bitness=Win64
    26. )
    28. set build=Release Debug
    29. if "%3" == "Release" (
    30. set build=Release
    31. )
    33. if "%3" == "Debug" (
    34. set build=Debug
    35. )
    37. REM This is required in order for "machine" and "arch" to be evaluated within the loops
    38. setlocal EnableDelayedExpansion
    39. for %%M in ( %build% ) do (
    40. for %%W in ( %bitness% ) do (
    41. REM and this ensures that any environment changes made by vcvarsall are scoped
    42. REM by the inner loop
    44. setlocal
    45. if %%W == Win32 (
    46. set machine=x86
    47. set arch=x86
    48. ) else (
    49. set machine=amd64
    50. set arch=x64
    51. )
    53. echo -- Starting %%W %%M
    54. if NOT EXIST build\%%W\%%M mkdir build\%%W\%%M
    55. cd build\%%W\%%M
    56. call "%ProgramFiles(x86)%\Microsoft Visual Studio %vsversion%\VC\vcvarsall" !machine!
    57. echo -- Generating %%W %%M
    58. cmake -G"NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=windows_toolchain.cmake -DBUILD_TYPE=%%M -DTARGET_ARCH=!arch! ..\..\..
    59. echo -- Building %%W %%M
    60. cmake --build . 2>&1 >build.log
    61. echo -- Installing %%W %%M
    62. cmake -P cmake_install.cmake
    63. echo -- Finished %%W %%M
    64. cd ..\..\..
    65. endlocal
    66. )
    67. )
    To copy to clipboard, switch view to plain text mode 

    The windows_toolchain.cmake sets up some CMake options for building my particular project:

    Qt Code:
    1. # target operating system
    2. set (CMAKE_SYSTEM_NAME Windows)
    3. set (WINDOWS true)
    5. set (CMAKE_BUILD_TYPE ${BUILD_TYPE} CACHE STRING "Choose the type of build" FORCE)
    7. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags" )
    To copy to clipboard, switch view to plain text mode 
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 2
    Last Post: 11th March 2014, 12:02
  2. Replies: 2
    Last Post: 22nd November 2011, 00:09
  3. Strange compiler behaviour (compiler passes wrong argument)
    By SasaVilic in forum General Programming
    Replies: 2
    Last Post: 2nd November 2010, 11:36
  4. configuration failure due to spaces in path
    By kondor in forum Installation and Deployment
    Replies: 7
    Last Post: 2nd October 2009, 07:33


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.