GCC生成链接问题
GCC Make Link Issue
我正试图在HTR工具Utils上执行make,但我面临以下问题:
gcc -g -Wall -lm -I./include -o pgmmedian pgmmedian.c libpgm.o
Undefined symbols for architecture x86_64:
"_CALC_MEDIAN", referenced from:
_main in pgmmedian-7918de.o
"_MERGE_SLICE", referenced from:
_main in pgmmedian-7918de.o
"_SORT_SLICE", referenced from:
_main in pgmmedian-7918de.o
"_pgm_getuint", referenced from:
_pgm_readpgminitrest in libpgm.o
_pgm_readpgmrow in libpgm.o
"_pgm_writepgmrowplain", referenced from:
_pgm_writepgmrow in libpgm.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pgmmedian] Error 1
Makefile:
#
# CONFIGURABLE OPTIONS
#
#CC = cc
CC = gcc
#CFLAGS = -O3 -I.
CFLAGS = -g
WFLAGS = -Wall
LDFLAGS = -lm
#LDFLAGS = -s
BINARIESDIR = $(HOME)/bin
SCRIPTSDIR = $(HOME)/scripts
EXAMPLESDIR = $(HOME)/CATTI-Examples
...
我在OSX El Captain上跑步。我读到一些问题建议用g++而不是gcc运行,但运气不佳
使用gcc-lstdc++,我得到相同的错误,使用g++(通过在Makefile中更改它们),我得到:
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
pgmskew.c:24:10: fatal error: 'values.h' file not found
#include <values.h>
^
1 error generated.
make: *** [pgmskew] Error 1
➜gcc-v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
有什么建议吗?提前谢谢。
您缺少一些定义这些符号的库。您需要了解libpgm.o
库需要什么并链接到它。
相关文章:
- 静态数据成员的问题-修复链接错误会导致编译器错误
- 基于boost的程序的静态链接——zlib问题
- 使用jsoncpp库时出现链接问题
- Cmake 链接问题:未定义对 Button::mousePressEvent(QGraphicsSceneMouseE
- sqlite3 和生成文件中的链接出现问题
- 如何将GTest与CMake一起使用?遵循谷歌指南时的链接问题
- 未解决的外部链接问题
- 使用转换器提升 Python 问题 - 静态链接
- 'make check' GLIBC 运行时的链接问题
- 在树莓派上用libtorch构建程序时的链接问题
- QtCreator with C 库中的链接器问题
- 野牛弹性链接问题
- 与 AWS 开发工具包的链接问题
- 使用 NVIDIA GPU 在 Cygwin 中链接 OpenCL 库时遇到问题
- 为什么当我从语句检查中删除"+ mod"时,以下程序给出错误的答案。问题链接:https://www.codechef.com/problems/FFC219B
- PCL 和 CMake 的问题:链接时未定义统计异常值删除
- VC++使用gumbo查询时出现问题(链接错误)
- 使用CMake问题链接Boost(Ubuntu 14.04)
- MySQL连接器问题-链接等等
- MinGW 与 MSVC 的 dll 库问题链接(未定义的引用)