鱼C论坛

 找回密码
 立即注册
查看: 3897|回复: 5

cmake的问题

[复制链接]
发表于 2019-3-24 14:10:10 | 显示全部楼层 |阅读模式
10鱼币
我的CMakeLists.txt:
  1. cmake_minimum_required(VERSION 3.4)
  2. set(CMAKE_C_COMPILER "gcc")
  3. set(CMAKE_CXX_COMPILER "g++")
  4. set(CMAKE_MAKE_PROGRAM  "mingw32-make")
  5. project(fraction)
  6. 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>

小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2019-3-24 14:12:41 | 显示全部楼层
我原来用的最新版的cmake也报错,我以为是版本太新了
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 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)
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2019-3-26 09:02:44 | 显示全部楼层
这个已经解决了,是路径的问题
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2019-3-26 09:47:18 | 显示全部楼层
是gcc 吗  没见过这样奇怪的码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-8-4 09:00:12 | 显示全部楼层
我也遇到一样的问题,楼主怎么解决的能详细说说嘛,求教
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-7-16 14:07

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表