error: ld returned 1 exit status

工具Code::Blocks

项目类型:C++控制台程序

构建日志

-------------- 构建: Debug 在 CPlus 中 (编译器: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -g -Iinclude -c D:\workspace\CPlus\include\b.h -o include\b.h.gch
mingw32-g++.exe -o bin\Debug\CPlus.exe include\b.h.gch obj\Debug\main.o obj\Debug\src\b.o
include\b.h.gch: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 分, 1 秒)
1 error(s), 0 warning(s) (0 分, 1 秒)

构建信息

=== 构建: Debug 在 CPlus 中 (编译器: GNU GCC Compiler) ===
error: ld returned 1 exit status|
=== 构建 失败: 1 error(s), 0 warning(s) (0 分, 1 秒) ===

原因:C++中的头文件不需要编译和链接

解决策:把头文件的选项中的编译文件和链接文件去掉,然后重新编译即可

posted on 2016-04-16 12:28  千年菜鸟  阅读(2292)  评论(0编辑  收藏  举报