1

I am on Windows and I try to compile a C/C++ program using CMake-gui.

I have Visual Studio 2019 installed on my PC.

I set as Windows environment variable for CXX the following path:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64

But when I click on 'Configure' in CMake-gui, I get the following error:

The C compiler identification is unknown
CMake Error at C:/Users/user1/mylibs/cmake-3.22.0-rc1-windows-x86_64/share/cmake-3.22/Modules/CMakeDetermineCXXCompiler.cmake:48 (message):
  Could not find compiler set in environment variable CXX:

  C:\Program Files (x86)\Microsoft Visual
  Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64.

Call Stack (most recent call first):
  CMakeLists.txt:56 (PROJECT)


CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!
See also "C:/Users/user1/mylibs/assimp-master_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/user1/mylibs/assimp-master_build/CMakeFiles/CMakeError.log".

Any idea how to solve this issue?

Thanks

toto_tata
  • 14,526
  • 27
  • 108
  • 198

1 Answers1

1

Most likely you need to execute C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat a batch file that sets all related environment variables.

You can also try opening from the Start menu "Developer Command Prompt for VS 2019" and executing vcvarsall.bat directly.

Peter
  • 2,796
  • 1
  • 17
  • 29
  • When executing this vcvarsall.bat, I get : [ERROR:vcvarsall.bat] Error in script usage. The correct usage is: Syntax: vcvarsall.bat [arch] [platform_type] [winsdk_version] [-vcvars_ver=vc_version] [-vcvars_spectre_libs=spectre_mode] where : [arch]: x86 | amd64 | x86_amd64 | x86_arm | x86_arm64 | amd64_x86 | amd64_arm | amd64_arm64 [platform_type]: {empty} | store | uwp etc... Any idea ? Thanks Please make sure either Visual Studio or C++ Build SKU is installed. – toto_tata Oct 21 '21 at 15:03
  • @Regis_AG have you installed the C++ workload? If not, open the Visual Studio installer and select "Desktop development with C++" workload. https://learn.microsoft.com/en-us/cpp/build/vscpp-step-0-installation?view=msvc-160 – Peter Oct 21 '21 at 17:59