我試圖在運行Windows 10的計算機上安裝一組可執行文件,並且在下載源代碼之後,我需要使用cmake編譯它們。我下載了最新版本的CMake的,和(設置適當的工作目錄後)一直在努力,以安裝可執行文件運行在Windows命令提示符下輸入以下命令:爲什麼cmake沒有找到編譯器cl
mkdir build
cd build
cmake ../
make
然而,cmake的一貫命令產生以下錯誤,並不能產生任何形式的make文件中的make命令可以使用:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Hannah/Documents/nupack3.2.0/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Hannah/Documents/nupack3.2.0/build/CMakeFiles/CMakeError.log".
我已經嘗試了許多解決方案,爲cmake的工作,和他們都沒有工作。我試圖將我的cmake文件夾的bin添加到我的PATH環境變量中,我試圖重新安裝我的cmake副本,並嘗試使用CMake GUI來生成make文件(Running CMake on Windows),甚至下載Visual Studio (How to set cmake CXX variable on windows),但因爲我沒有足夠的經驗來使用CMake GUI或Visual Studio,或者因爲還有其他問題,所以似乎沒有任何工作,cmake ../
產生完全相同的錯誤。
任何人都可以爲我提供一些備用解決方案,以便如何使此命令有效嗎?
***在Windows命令提示符下***我將使用您正在使用的Visual Studio版本的Visual Studio命令提示符。或者至少在命令提示符下執行vcvarsall.bat。這就是說你不要在Visual Studio中使用'make'。 – drescherjm
你在CMake中使用了什麼發電機?你使用什麼編譯器? – drescherjm
***我試圖將我的cmake文件夾的bin添加到我的PATH環境變量中***我的窗口中有我的路徑中的CMake bin。我每天在一臺半打電腦上用Visual Studio進行CMake。 – drescherjm