100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > CMakeLists.txt文件常见编译错误

CMakeLists.txt文件常见编译错误

时间:2022-09-30 06:03:12

相关推荐

CMakeLists.txt文件常见编译错误

错误一:目标文件未成功链接到该函数HelloFunc所在的库文件或者未安装该库文件

CMakeFiles/hello.dir/main.c.o:在函数‘main’中:

main.c:(.text+0xa):对‘HelloFunc’未定义的引用

collect2: error: ld returned 1 exit status

src/CMakeFiles/hello.dir/build.make:96: recipe for target ‘src/hello’ failed

make[2]: *** [src/hello] Error 1

CMakeFiles/Makefile2:97: recipe for target ‘src/CMakeFiles/hello.dir/all’ failed

make[1]: *** [src/CMakeFiles/hello.dir/all] Error 2

Makefile:90: recipe for target ‘all’ failed

make: *** [all] Error 2

错误二:主工程CMakeLists.txt的头文件搜索路径, 未包含函数HelloFunc所在的头文件

~/cmake/t6/src/main.c:1:10: fatal error: hello.h: 没有那个文件或目录

#include <hello.h>

^~~~~~~~~

compilation terminated.

src/CMakeFiles/hello.dir/build.make:75: recipe for target ‘src/CMakeFiles/hello.dir/main.c.o’ failed

make[2]: *** [src/CMakeFiles/hello.dir/main.c.o] Error 1

CMakeFiles/Makefile2:97: recipe for target ‘src/CMakeFiles/hello.dir/all’ failed

make[1]: *** [src/CMakeFiles/hello.dir/all] Error 2

Makefile:90: recipe for target ‘all’ failed

make: *** [all] Error 2

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。