# Windows configure error when using the command line: "The C/CXX compiler identification is unknown.."

**URL:** https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053
**Category:** Usage
**Created:** [September 8, 2021, 9:47am UTC](https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053 "2021-09-08T09:47:50Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![StevenWang](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/41988e/32.png) [@StevenWang](https://discourse.cmake.org/u/StevenWang)
#### Post date: [September 8, 2021, 9:47am UTC](https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053/1 "2021-09-08T09:47:50Z")

</div>

I fail to use the command line to configure, reporting errors as “The C compiler identification is unknown and The CXX compiler identification is unknown”.  
 ![image](https://discourse.cmake.org/uploads/default/original/2X/2/2c39759828f14f84f9c4abbf8a882dcf2f3c068d.png)

But for the same project, it is successful when using the cmake-gui. My cmake version is 3.20.4.  
report information like:  
Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.  
The C compiler identification is MSVC 19.16.27045.0  
The CXX compiler identification is MSVC 19.16.27045.0  
Detecting C compiler ABI info  
Detecting C compiler ABI info - done  
Check for working C compiler: D:/Program Files/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped  
Detecting C compile features  
Detecting C compile features - done  
Detecting CXX compiler ABI info  
Detecting CXX compiler ABI info - done  
Check for working CXX compiler: D:/Program Files/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped  
Detecting CXX compile features  
Detecting CXX compile features - done  
operation system is Windows-10.0.19042  
Found OpenMP\_C: -openmp (found version “2.0”)  
Found OpenMP\_CXX: -openmp (found version “2.0”)  
Found OpenMP: TRUE (found version “2.0”)

Anyone could help? I don’t know why there is a difference in my vs2017 build and how to solve it in command-line way.

---

<div class="post-metadata">

### Author: ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)
#### Post date: [September 8, 2021, 12:05pm UTC](https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053/2 "2021-09-08T12:05:58Z")

</div>

Guessing: The cmake-gui chooses the 32bit (host and target) version of the compiler. You choose the host=64bit version with CLI

---

<div class="post-metadata">

### Author: ![fdk17](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/ea666f/32.png) [@fdk17](https://discourse.cmake.org/u/fdk17)
#### Post date: [September 8, 2021, 2:12pm UTC](https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053/3 "2021-09-08T14:12:12Z")

</div>

When you use the GUI it appears to be using the Hostx86 tools not Hostx64. Did the command line version work when not specifying the toolset with `-T`.

---

<div class="post-metadata">

### Author: ![StevenWang](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/41988e/32.png) [@StevenWang](https://discourse.cmake.org/u/StevenWang)
#### Post date: [September 9, 2021, 1:19am UTC](https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053/4 "2021-09-09T01:19:33Z")

</div>

It still has the same prompt error when removing the “-T” option.

---

<div class="post-metadata">

### Author: ![StevenWang](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/41988e/32.png) [@StevenWang](https://discourse.cmake.org/u/StevenWang)
#### Post date: [September 9, 2021, 1:55am UTC](https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053/5 "2021-09-09T01:55:41Z")

</div>

I try to add the x86 compiler path “D:\Program Files\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86” to the system environment path, it still has the same error.

Actually, I don’t know how the cmake-gui works and why it chooses the x86/32bits option. And how it detects the complier information of:

The C compiler identification is MSVC 19.16.27045.0  
The CXX compiler identification is MSVC 19.16.27045.0

I have local search results for the cl.exe as shown below…

 ![image](https://discourse.cmake.org/uploads/default/original/2X/d/d2a92581cda9742cb5ba9d08c77f66dd850e602c.png)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 9, 2021, 2:36am UTC](https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053/6 "2021-09-09T02:36:07Z")

</div>

Usually this means that something like the SDK isn’t installed. Does the toolchain work outside of CMake?

---

<div class="post-metadata">

### Author: ![StevenWang](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/41988e/32.png) [@StevenWang](https://discourse.cmake.org/u/StevenWang)
#### Post date: [September 9, 2021, 3:13am UTC](https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053/7 "2021-09-09T03:13:06Z")

</div>

I tested a simple cpp file using the shell of MSVC tool, the cl build was successful.

 ![image](https://discourse.cmake.org/uploads/default/original/2X/0/068efa5edbe5ae6f4205ff1b528e8611d5967d2a.png)

While I try the cmake command in the same shell, it prompt the same error…  
– Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.  
– The C compiler identification is unknown  
– The CXX compiler identification is unknown  
CMake Error at CMakeLists.txt:2 (project):  
No CMAKE\_C\_COMPILER could be found.  
CMake Error at CMakeLists.txt:2 (project):  
No CMAKE\_CXX\_COMPILER could be found.

---

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [September 9, 2021, 8:20pm UTC](https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053/8 "2021-09-09T20:20:25Z")

</div>

Hello @StevenWang we ended up finding a solution over on this [discourse](https://discourse.cmake.org/t/no-cmake-c-compiler-could-be-found-no-cmake-cxx-compiler-could-be-found/3948/17). Try temporarily minimizing your PATH variable to see if that helps as shown in that thread.

---

<div class="post-metadata">

### Author: ![StevenWang](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/41988e/32.png) [@StevenWang](https://discourse.cmake.org/u/StevenWang)
#### Post date: [September 10, 2021, 1:31am UTC](https://discourse.cmake.org/t/windows-configure-error-when-using-the-command-line-the-c-cxx-compiler-identification-is-unknown/4053/9 "2021-09-10T01:31:25Z")

</div>

Yes, minimizing the PATH in temp can solve this CLI issue!

Thank you and everyone who helped me so much.
