我了解什么是未解决的符号错误,但我不明白为什么我会在这个特定库的这种特殊情况下得到它。这是错误的输出。
Undefined symbols for architecture x86_64:
"soci::soci_error::soci_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
soci::type_conversion<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void>::from_base(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, soci::indicator, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in Inspector.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
请注意,我正在使用以下链接标志:
-L/usr/local/lib -lsoci_core -lsoci_postgresql -lpq -ldl
另请注意,soci::session
正在解析对其他符号(例如,构造函数和析构函数)的引用。
我究竟做错了什么?是否还有另一个我应该链接的 soci 库?
编辑:请注意,我正在使用 Mac OS X,并尝试通过自制软件(通过brew install soci --with-pg
)进行安装,以及 3.2.2 和 3.2.1 的独立安装。