CMake错误 - 使用柯南

时间:2017-10-18 15:00:42

标签: c++ cmake sdl conan

我只是弄清楚为什么我会收到这个错误,有人会介意给我一些帮助吗?

我已将Cmake添加到Environment变量中,但仍然出现错误。我现在是一名大学生,试图让SDL工作。

我的机器是x64,我安装了所有C ++元素的Visual Studio 2017。

这是CMD错误: CMD Error

以下是GUI错误: GUI Error

复制 - 粘贴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

(我还尝试过手动构建(conan install --build missing))

1 个答案:

答案 0 :(得分:0)

“我的机器是x64,我安装了所有C ++元素的Visual Studio 2017。”

您正在为错误版本的Visual Studio生成解决方案..

cmake .. -G "Visual Studio 14 2015 Win64"

将批处理脚本中的该行更改为:

cmake .. -G "Visual Studio 15 2017 Win64"

然后你必须删除所有生成的文件(CMakeCache.txt', 'CMakeFiles dir等等),然后再试一次。还请仔细检查您的柯南配置文件设置是否与您使用的编译器匹配。