2017-06-29 65 views
1

我試圖在運行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 ../產生完全相同的錯誤。

任何人都可以爲我提供一些備用解決方案,以便如何使此命令有效嗎?

+0

***在Windows命令提示符下***我將使用您正在使用的Visual Studio版本的Visual Studio命令提示符。或者至少在命令提示符下執行vcvarsall.bat。這就是說你不要在Visual Studio中使用'make'。 – drescherjm

+0

你在CMake中使用了什麼發電機?你使用什麼編譯器? – drescherjm

+0

***我試圖將我的cmake文件夾的bin添加到我的PATH環境變量中***我的窗口中有我的路徑中的CMake bin。我每天在一臺半打電腦上用Visual Studio進行CMake。 – drescherjm

回答

1

已經下載了他們的二進制文件後,我需要使用cmake

這是沒有意義的編譯它們。您可以下載來源並需要編譯它們,或者您下載了二進制文件,並且不需要編譯任何其他文件。

如果事實證明你需要編譯,你將不得不安裝一個編譯器(比如Visual Studio)。一旦安裝VS,CMake應該沒有問題找到它(當使用VS發電機時)。

然而,您的錯誤消息似乎表明使用NMake生成器,它需要從正確配置用於構建的命令提示符運行。在安裝Visual Studio時,應該在開始菜單中提供開發命令提示符的快捷方式。爲您的平臺啓動正確的並從那裏運行CMake。

+0

對於術語混淆的問題,我對這些流程很陌生。我的意思是說我已經下載了源代碼並需要編譯它們。我現在將更正我的文本 –

+0

另外,我已經在命令提示符下多次運行NMake生成器,但它仍然不起作用。我也嘗試過使用其他生成器(https://stackoverflow.com/questions/4101456/running-cmake-on-windows),但它沒有區別 –

相關問題