lcl1026504480 发表于 2019-3-24 14:10:10

cmake的问题

我的CMakeLists.txt:
cmake_minimum_required(VERSION 3.4)
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_MAKE_PROGRAM"mingw32-make")
project(fraction)
add_executable(fraction fraction2,cxx)
结果为什么是这样:
S C:\Users\lenovouser\Desktop\cpp\Lesson17\fraction> cmake . -G"MinGW Makefiles"
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "" "cmTC_f2b2f/fast"
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe -- broken
CMake Error at D:/cmake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "D:/MinGW/mingw64/bin/gcc.exe" is not able to compile a
simple test program.

It fails with the following output:

   Change Dir: C:/Users/lenovouser/Desktop/cpp/Lesson17/fraction/CMakeFiles/CMakeTmp



Run Build Command:"" "cmTC_f2b2f/fast"



Generator: execution of make failed.Make command was: ""
"cmTC_f2b2f/fast"





CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:5 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/lenovouser/Desktop/cpp/Lesson17/fraction/CMakeFiles/CMakeOutput.log".
See also "C:/Users/lenovouser/Desktop/cpp/Lesson17/fraction/CMakeFiles/CMakeError.log".
PS C:\Users\lenovouser\Desktop\cpp\Lesson17\fraction>

lcl1026504480 发表于 2019-3-24 14:12:41

我原来用的最新版的cmake也报错,我以为是版本太新了

lcl1026504480 发表于 2019-3-24 14:15:03

cmake_minimum_required(VERSION 3.4)
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_MAKE_PROGRAM"mingw32-make")
project(fraction)
add_executable(fraction fraction2.cpp)

lcl1026504480 发表于 2019-3-26 09:02:44

这个已经解决了,是路径的问题

wp231957 发表于 2019-3-26 09:47:18

是gcc 吗没见过这样奇怪的码

我有一只小怪兽 发表于 2020-8-4 09:00:12

我也遇到一样的问题,楼主怎么解决的能详细说说嘛,求教
页: [1]
查看完整版本: cmake的问题