Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C语言中的编译问题_C_Compilation_Linker Errors - Fatal编程技术网

C语言中的编译问题

C语言中的编译问题,c,compilation,linker-errors,C,Compilation,Linker Errors,我在编译程序时遇到了一个问题,我不知道为什么。我认为这是图书馆的问题,但我不确定。我在谷歌上搜索,但我无法解决这个问题 命令行: clang `pkg-config --libs opencv ` main.o image_handle.o image_detection.o neural_network.o -o main 这是我的错误消息: /usr/bin/ld: neural_network.o: undefined reference to symbol 'exp@@GLIBC

我在编译程序时遇到了一个问题,我不知道为什么。我认为这是图书馆的问题,但我不确定。我在谷歌上搜索,但我无法解决这个问题

命令行:

clang `pkg-config --libs opencv `  main.o image_handle.o image_detection.o neural_network.o   -o main
这是我的错误消息:

/usr/bin/ld: neural_network.o: undefined reference to symbol 'exp@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [main] Error 1 这是链接器告诉你它找到了它想要的符号,但不是在你要求它链接的库中。因此,您应该将该库添加到命令行中。libm的标志是-lm


在命令行中将库放在需要它们的对象之后。

链接时参数的顺序很重要-需要在对象文件之后列出库。尝试:

clang main.o image_handle.o image_detection.o neural_network.o   -o main `pkg-config --libs opencv `

你能发布你的代码吗?@onegrx:那有什么帮助?我的代码很长。但是它是在我同事的电脑上编译的,所以我认为代码对你没有帮助。当我们开始使用时,错误消息开始出现。我已尝试在CFLAGS上添加-lm标志,但没有任何更改。我已经在我的问题中添加了我的makefile。CLAGS的末尾不是正确的位置。LDFLAGS的结尾应该是。如果仍然不起作用,请发布编辑的makefile和更新的、精确的编译器输出。
/lib/x86_64-linux-gnu/libm.so.6: error adding symbols:
                                 DSO missing from command line
clang main.o image_handle.o image_detection.o neural_network.o \
       `pkg-config --libs opencv ` -lm -o main
clang main.o image_handle.o image_detection.o neural_network.o   -o main `pkg-config --libs opencv `