libconfig++が機能する非常に単純な例を取得しようとしています。ただし、コンパイラオプション「-stdlib =libc++」および「-std=c ++ 11」が原因で、次のリンクエラーが発生しています。
環境
ダーウィンiMac.local12.2.0
Darwinカーネルバージョン12.2.0
xnu-2050.18.24〜1 / RELEASE_X86_64 x86_64
ソース
Config cfg;
cfg.readFile( "example.cfg" );
string value = "";
const string& key = "application.base";
cfg.lookupValue( key, value );
建てる
clang ++ -o main main.cpp -lconfig ++ -stdlib = libc ++ -std = c ++ 11
エラー
Undefined symbols for architecture x86_64: "libconfig::Config::lookupValue(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const", referenced from:
libconfig::Config::lookupValue(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const in main-mFa01w.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)