【发布时间】:2023-03-11 22:05:01
【问题描述】:
我只是想不通为什么我会收到这个错误,有人介意给我一些帮助吗?
我已将 Cmake 添加到环境变量中,但仍然出现错误。我目前是一名大学生,正在努力让 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 缺失))
【问题讨论】:
-
复制粘贴错误,而不是发布它们的屏幕截图。
-
错误提示CMake找不到Visual Studio安装的MSVC编译器。您能否确认您安装了 VS 2015,并选择 C++ 编译器作为其安装组件的一部分?
-
我目前使用的是 VS 2017(已安装 C++,我可以制作项目),我的朋友建议我卸载 VS 2015 来解决问题,但它没有用:/“Visual Studio 15 2017”有在 CMake gui 中被选中。
-
有什么原因你没有为 zlib 使用这个柯南包吗? bintray.com/conan-community/conan/zlib%3Aconan/1.2.8%3Astable
-
@ChristopherRoss 您说您使用的是 Visual Studio 2017,那么为什么要为 VS2015 生成解决方案?
cmake .. -G "Visual Studio 14 2015 Win64"