[英]CMake Errors - Using Conan
我只是想不出為什么我會收到此錯誤,有人願意給我一些幫助嗎?
我已經將Cmake添加到環境變量中,但是仍然出現錯誤。 我目前是一名試圖讓SDL正常工作的大學生。
我的機器是x64,我安裝了Visual Studio 2017,其中安裝了所有C ++元素。
這是CMD錯誤: CMD錯誤
這是GUI錯誤: GUI錯誤
復制-粘貼CMD版本:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:1 (PROJECT):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:1 (PROJECT):
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Chris Ross/.conan/data/zlib/1.2.8/lasote/stable/build/6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Chris Ross/.conan/data/zlib/1.2.8/lasote/stable/build/6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7/_build/CMakeFiles/CMakeError.log".
zlib/1.2.8@lasote/stable:
zlib/1.2.8@lasote/stable: ERROR: Package '6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7' build failed
zlib/1.2.8@lasote/stable: WARN: Build folder C:\Users\Chris Ross\.conan\data\zlib\1.2.8\lasote\stable\build\6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
ERROR: zlib/1.2.8@lasote/stable: Error in build() method, line 60
self.run('%s && cmake .. %s' % (cd_build, cmake.command_line))
ConanException: Error 1 while executing cd _build && cmake .. -G "Visual Studio 15 2017 Win64" -DCONAN_LINK_RUNTIME="/MD" -DCONAN_EXPORTED="1" -DCONAN_COMPILER="Visual Studio" -DCONAN_COMPILER_VERSION="15" -DCONAN_CXX_FLAGS="/MP4" -DCONAN_C_FLAGS="/MP4" -Wno-dev
INFO: Conan job finished.
INFO: Starting cmake
CMake Error: Error: generator : Visual Studio 14 2015 Win64
Does not match the generator used previously: Visual Studio 15 2017 Win64
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
INFO: CMake job finished.
復制-粘貼GUI版本:
CMAKE_CONFIGURATION_TYPES Debug;Release;MinSizeRel;RelWithDebInfo
CMAKE_INSTALL_PREFIX C:/Program Files (x86)/lab1
Configuring incomplete, errors occurred!
See also "C:/Users/Chris Ross/Desktop/lab2template/bin/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Chris Ross/Desktop/lab2template/bin/CMakeFiles/CMakeError.log".
我的conanfile.txt:
[requires]
SDL2/2.0.5@dotfloat/stable
SDL2_image/2.0.1@lasote/stable
SDL2_mixer/2.0.1@a_teammate/testing
SDL2_ttf/2.0.14@hilborn/stable
[options]
SDL2:shared=True
SDL2_image:shared=False
SDL2_mixer:shared=True
SDL2_ttf:shared=False
[generators]
cmake
[imports]
bin, *.dll -> ./bin # Copies all dll files from packages bin folder to my "bin" folder
lib, *.dylib* -> ./bin # Cop
使用此.bat文件:
@echo off
:start
echo INFO: I am running from '%cd%'
if exist src goto changetobin
:conan
echo INFO: Starting conan
conan install --build missing
echo INFO: Conan job finished.
goto cmake
:cmake
echo INFO: Starting cmake
cmake .. -G "Visual Studio 14 2015 Win64"
echo INFO: CMake job finished.
goto end
:changetobin
echo ERROR: I'm in the wrong directory.. moving into bin
cd bin
echo INFO: Retrying..
goto start
:end
if exist bin goto quit
cd ..
goto quit
:quit
echo.
echo.
echo INFO: Conan and CMake ran successfully. Open up your solution file (listed below) to open your project.
echo.
dir /b *.sln
(我也嘗試過手動構建(缺少柯南安裝--build))
“我的機器是x64,我安裝了Visual Studio 2017,其中安裝了所有C ++元素。”
您正在為錯誤版本的Visual Studio生成解決方案。
cmake .. -G "Visual Studio 14 2015 Win64"
將批處理腳本中的該行更改為:
cmake .. -G "Visual Studio 15 2017 Win64"
然后,您必須刪除所有生成的文件( CMakeCache.txt', 'CMakeFiles
dir等),然后重試。 還請仔細檢查您的柯南配置文件設置是否與您使用的編譯器匹配。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.