简体   繁体   中英

Unresolved symbol error with the soci library

I understand what an unresolved symbol error is, but I don't understand why I'm getting it in this particular situation with this particular library. Here is the output of the error.

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)

Note that I am using the following link flags:

-L/usr/local/lib -lsoci_core -lsoci_postgresql -lpq -ldl

Note also that references to other symbols (eg, the soci::session constructor and destructor) are being resolved.

What am I doing wrong? Is there another soci library that I should also be linking against?

EDIT : Note that I am working on Mac OS X, and have tried both the installation through homebrew (via brew install soci --with-pg ), and the standalone installations of 3.2.2 and 3.2.1.

我不知道为什么这可以解决错误,但是从libc ++更改为libstdc ++可以解决此错误。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM