I have made an iPhone app in Xcode that uses the DropBox API. I have got 23 errors all named Apple Mach-O Linker Errors. I have linked my binary with the dropbox library as well as: SystemConfiguration, QuartzCore, Security, CFNetwork, CoreGraphics, UIKit and Foundation. I am not using all of those frameworks but DropBox told me I must import some of them, and I am using the rest.
What should I do?
Here is one of the errors:
Ld /Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop-fwhwffwawcnkfwbxvokogcjaaahb/Build/Products/Debug-iphoneos/SnapDrop.app/SnapDrop normal armv7
cd /Users/Zach/Desktop/SnapDrop
setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
setenv PATH "/Applications/Xcode5-DP3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode5-DP3.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode5-DP3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode5-DP3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop-fwhwffwawcnkfwbxvokogcjaaahb/Build/Products/Debug-iphoneos -F/Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop-fwhwffwawcnkfwbxvokogcjaaahb/Build/Products/Debug-iphoneos -F/Users/Zach/Desktop/SnapDrop -F/Users/Zach/Desktop/SnapDrop/../../Downloads/dropbox-ios-sync-sdk-1-1.1.0 -filelist /Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop-fwhwffwawcnkfwbxvokogcjaaahb/Build/Intermediates/SnapDrop.build/Debug-iphoneos/SnapDrop.build/Objects-normal/armv7/SnapDrop.LinkFileList -dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.0 -framework Dropbox -framework QuartzCore -framework SystemConfiguration -framework Security -framework CFNetwork -framework CoreGraphics -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop-fwhwffwawcnkfwbxvokogcjaaahb/Build/Intermediates/SnapDrop.build/Debug-iphoneos/SnapDrop.build/Objects-normal/armv7/SnapDrop_dependency_info.dat -o /Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop-fwhwffwawcnkfwbxvokogcjaaahb/Build/Products/Debug-iphoneos/SnapDrop.app/SnapDrop
Undefined symbols for architecture armv7:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)", referenced from:
dbx_api_account_info(dbx_account*, std::__1::unique_ptr<dbx_account_info, dbx_account_info_deleter>*, std::__1::unique_ptr<dbx_access_info, std::__1::default_delete<dbx_access_info> >*, HttpRequester&, int) in Dropbox(api.o)
dbx_url_encode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Dropbox(util.o)
dbx_build_url_with_params(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&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) in Dropbox(util.o)
"operator new(unsigned long)", referenced from:
std::__1::__function::__func<HttpRequester::HttpRequester(dbx_env*, LifecycleManager&, std::__1::mutex*, void*, void (*)(void*), void*)::'lambda'(), std::__1::allocator<HttpRequester::HttpRequester(dbx_env*, LifecycleManager&, std::__1::mutex*, void*, void (*)(void*), void*)::'lambda'()>, void ()>::__clone() const in Dropbox(env.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)", referenced from:
dbx_api_account_info(dbx_account*, std::__1::unique_ptr<dbx_account_info, dbx_account_info_deleter>*, std::__1::unique_ptr<dbx_access_info, std::__1::default_delete<dbx_access_info> >*, HttpRequester&, int) in Dropbox(api.o)
dbx_url_encode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Dropbox(util.o)
dbx_build_url_with_params(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&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) in Dropbox(util.o)
"std::__1::chrono::system_clock::now()", referenced from:
std::__1::cv_status std::__1::condition_variable::wait_for<long long, std::__1::ratio<1ll, 1000ll> >(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::duration<long long, std::__1::ratio<1ll, 1000ll> > const&) in Dropbox(sync.o)
std::__1::cv_status std::__1::condition_variable::wait_for<long, std::__1::ratio<3600ll, 1ll> >(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::duration<long, std::__1::ratio<3600ll, 1ll> > const&) in Dropbox(api.o)
"std::__1::chrono::steady_clock::now()", referenced from:
std::__1::cv_status std::__1::condition_variable::wait_for<long long, std::__1::ratio<1ll, 1000ll> >(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::duration<long long, std::__1::ratio<1ll, 1000ll> > const&) in Dropbox(sync.o)
std::__1::cv_status std::__1::condition_variable::wait_for<long, std::__1::ratio<3600ll, 1ll> >(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::duration<long, std::__1::ratio<3600ll, 1ll> > const&) in Dropbox(api.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*)", referenced from:
dbx_access_info::is_valid(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const in Dropbox(sync.o)
dbx_api_account_info(dbx_account*, std::__1::unique_ptr<dbx_account_info, dbx_account_info_deleter>*, std::__1::unique_ptr<dbx_access_info, std::__1::default_delete<dbx_access_info> >*, HttpRequester&, int) in Dropbox(api.o)
dbx_build_url_with_params(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&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) in Dropbox(util.o)
"std::__1::__throw_system_error(int, char const*)", referenced from:
std::__1::unique_lock<std::__1::mutex>::unlock() in Dropbox(transfer.o)
std::__1::unique_lock<std::__1::mutex>::lock() in Dropbox(transfer.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
dbx_build_url_with_params(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&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) in Dropbox(util.o)
"std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&)", referenced from:
LifecycleManager::shutdown() in Dropbox(init.o)
dbx_env::log_upload_thread() in Dropbox(env.o)
"std::nothrow", referenced from:
_dropbox_env_init in Dropbox(init.o)
_dropbox_account_init in Dropbox(init.o)
HttpRequester::create(dbx_env*, LifecycleManager&, std::__1::mutex*, void*, void (*)(void*)) in Dropbox(env.o)
dbx_api_account_info(dbx_account*, std::__1::unique_ptr<dbx_account_info, dbx_account_info_deleter>*, std::__1::unique_ptr<dbx_access_info, std::__1::default_delete<dbx_access_info> >*, HttpRequester&, int) in Dropbox(api.o)
ThreadLocal<dbx_error_buf>::get() in Dropbox(util.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
dbx_env::~dbx_env() in Dropbox(init.o)
build_authed_url(dbx_account const*, 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&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) in Dropbox(api.o)
dbx_request_json(dbx_account*, HttpRequester&, 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&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, char const*, int, std::initializer_list<int> const&, std::__1::unique_ptr<json_t, json_deleter>&) in Dropbox(api.o)
_dropbox_api_unlink in Dropbox(api.o)
dbx_api_account_info(dbx_account*, std::__1::unique_ptr<dbx_account_info, dbx_account_info_deleter>*, std::__1::unique_ptr<dbx_access_info, std::__1::default_delete<dbx_access_info> >*, HttpRequester&, int) in Dropbox(api.o)
dbx_upload_log_file(dbx_env const*, HttpRequester&, char const*, long long, long long, char const*, long long) in Dropbox(api.o)
dbx_build_url_with_params(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&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) in Dropbox(util.o)
...
"std::__1::condition_variable::notify_all()", referenced from:
LifecycleManager::kick_cvars() in Dropbox(init.o)
LifecycleManager::ThreadRegistration::~ThreadRegistration() in Dropbox(transfer.o)
LifecycleManager::ThreadRegistration::ThreadRegistration(LifecycleManager&) in Dropbox(transfer.o)
dbx_env::dump_log_buffer() const in Dropbox(env.o)
dbx_env::log_upload_thread() in Dropbox(env.o)
"std::__1::condition_variable::~condition_variable()", referenced from:
_dropbox_account_init in Dropbox(init.o)
_dropbox_account_destroy in Dropbox(init.o)
dbx_env::~dbx_env() in Dropbox(init.o)
__GLOBAL__I_a in Dropbox(env.o)
"std::__1::mutex::unlock()", referenced from:
_dropbox_set_online in Dropbox(init.o)
_dropbox_lib_setup in Dropbox(init.o)
_dropbox_env_shutdown in Dropbox(init.o)
_dropbox_account_init in Dropbox(init.o)
_dropbox_account_shutdown in Dropbox(init.o)
void LifecycleManager::all_lock_helper<void, dropbox_set_online::$_0>(vq_node<std::__1::mutex&>*, dropbox_set_online::$_0) in Dropbox(init.o)
LifecycleManager::shutdown() in Dropbox(init.o)
...
"operator new(unsigned long, std::nothrow_t const&)", referenced from:
_dropbox_env_init in Dropbox(init.o)
_dropbox_account_init in Dropbox(init.o)
HttpRequester::create(dbx_env*, LifecycleManager&, std::__1::mutex*, void*, void (*)(void*)) in Dropbox(env.o)
dbx_api_account_info(dbx_account*, std::__1::unique_ptr<dbx_account_info, dbx_account_info_deleter>*, std::__1::unique_ptr<dbx_access_info, std::__1::default_delete<dbx_access_info> >*, HttpRequester&, int) in Dropbox(api.o)
ThreadLocal<dbx_error_buf>::get() in Dropbox(util.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
dbx_api_account_info(dbx_account*, std::__1::unique_ptr<dbx_account_info, dbx_account_info_deleter>*, std::__1::unique_ptr<dbx_access_info, std::__1::default_delete<dbx_access_info> >*, HttpRequester&, int) in Dropbox(api.o)
dbx_url_encode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Dropbox(util.o)
dbx_build_url_with_params(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&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) in Dropbox(util.o)
"std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1ll, 1000000000ll> > >)", referenced from:
std::__1::cv_status std::__1::condition_variable::wait_for<long long, std::__1::ratio<1ll, 1000ll> >(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::duration<long long, std::__1::ratio<1ll, 1000ll> > const&) in Dropbox(sync.o)
std::__1::cv_status std::__1::condition_variable::wait_for<long, std::__1::ratio<3600ll, 1ll> >(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::duration<long, std::__1::ratio<3600ll, 1ll> > const&) in Dropbox(api.o)
"std::__1::mutex::~mutex()", referenced from:
_dropbox_account_init in Dropbox(init.o)
_dropbox_account_destroy in Dropbox(init.o)
dbx_env::~dbx_env() in Dropbox(init.o)
__GLOBAL__I_a in Dropbox(init.o)
__GLOBAL__I_a in Dropbox(env.o)
"operator delete(void*)", referenced from:
_dropbox_env_destroy in Dropbox(init.o)
_dropbox_account_init in Dropbox(init.o)
_dropbox_account_destroy in Dropbox(init.o)
dbx_env::log_upload_thread() in Dropbox(env.o)
std::__1::__function::__func<HttpRequester::HttpRequester(dbx_env*, LifecycleManager&, std::__1::mutex*, void*, void (*)(void*), void*)::'lambda'(), std::__1::allocator<HttpRequester::HttpRequester(dbx_env*, LifecycleManager&, std::__1::mutex*, void*, void (*)(void*), void*)::'lambda'()>, void ()>::~__func() in Dropbox(env.o)
std::__1::__function::__func<HttpRequester::HttpRequester(dbx_env*, LifecycleManager&, std::__1::mutex*, void*, void (*)(void*), void*)::'lambda'(), std::__1::allocator<HttpRequester::HttpRequester(dbx_env*, LifecycleManager&, std::__1::mutex*, void*, void (*)(void*), void*)::'lambda'()>, void ()>::destroy_deallocate() in Dropbox(env.o)
dbx_api_account_info(dbx_account*, std::__1::unique_ptr<dbx_account_info, dbx_account_info_deleter>*, std::__1::unique_ptr<dbx_access_info, std::__1::default_delete<dbx_access_info> >*, HttpRequester&, int) in Dropbox(api.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
dbx_env::dbx_env(dbx_http const*, dbx_env_config const*) in Dropbox(init.o)
build_authed_url(dbx_account const*, 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&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) in Dropbox(api.o)
_dropbox_api_unlink in Dropbox(api.o)
dbx_api_account_info(dbx_account*, std::__1::unique_ptr<dbx_account_info, dbx_account_info_deleter>*, std::__1::unique_ptr<dbx_access_info, std::__1::default_delete<dbx_access_info> >*, HttpRequester&, int) in Dropbox(api.o)
dbx_upload_log_file(dbx_env const*, HttpRequester&, char const*, long long, long long, char const*, long long) in Dropbox(api.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
build_authed_url(dbx_account const*, 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&, std::initializer_list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) in Dropbox(api.o)
dbx_upload_log_file(dbx_env const*, HttpRequester&, char const*, long long, long long, char const*, long long) in Dropbox(api.o)
"std::__1::mutex::lock()", referenced from:
_dropbox_set_online in Dropbox(init.o)
_dropbox_lib_setup in Dropbox(init.o)
_dropbox_env_shutdown in Dropbox(init.o)
_dropbox_account_init in Dropbox(init.o)
_dropbox_account_shutdown in Dropbox(init.o)
void LifecycleManager::all_lock_helper<void, dropbox_set_online::$_0>(vq_node<std::__1::mutex&>*, dropbox_set_online::$_0) in Dropbox(init.o)
LifecycleManager::shutdown() in Dropbox(init.o)
...
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You didn't mention adding libc++.dylib. Per https://www.dropbox.com/developers/sync/sdks/ios:
Ensure that you have CFNetwork.framework, Security.framework,
SystemConfiguration.framework, QuartzCore.framework, and libc++.dylib
added to your project. To do this, select your project file in the
file explorer, select your target, and select the Build Phases
sub-tab. Under Link Binary with Libraries, press the + button, select
CFNetwork.framework, and press Add. Repeat for Security.framework,
SystemConfiguration.framework, QuartzCore.framework, and libc++.dylib.
Please let me know if there are setup instructions somewhere that don't mention libc++.dylib.
You could try to add libstdc++.dylib.
Related
I've just downloaded this repo: UCTDom
And opening the project in Clion from the /UCTDom-master dir, or attempting to make from /UCTDom-master/Console4SimpleStorage/Console4SimpleStorage results in this missing architecture error:
Undefined symbols for architecture x86_64:
"BigMoneyAI::~BigMoneyAI()", referenced from:
Player::~Player() in main-cd1c38.o
"FlatUCBMod::~FlatUCBMod()", referenced from:
Player::~Player() in main-cd1c38.o
"HumanInputAI::~HumanInputAI()", referenced from:
Player::~Player() in main-cd1c38.o
"DoubleWitchAI::~DoubleWitchAI()", referenced from:
Player::~Player() in main-cd1c38.o
"SingleWitchAI::~SingleWitchAI()", referenced from:
Player::~Player() in main-cd1c38.o
"UCTMonteCarlo::~UCTMonteCarlo()", referenced from:
Player::~Player() in main-cd1c38.o
"Game::initialize()", referenced from:
playGame(Game&) in main-cd1c38.o
"Game::writeCSVLog(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
_main in main-cd1c38.o
"Game::writeToFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
writeToFile(Game&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in main-cd1c38.o
"Game::writeMoveHistoryToFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
_main in main-cd1c38.o
"Game::play()", referenced from:
playGame(Game&) in main-cd1c38.o
"Game::Game()", referenced from:
_main in main-cd1c38.o
"FlatUCB::~FlatUCB()", referenced from:
Player::~Player() in main-cd1c38.o
"RandomAI::~RandomAI()", referenced from:
Player::~Player() in main-cd1c38.o
"GameState::~GameState()", referenced from:
Game::~Game() in main-cd1c38.o
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in main-cd1c38.o
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(unsigned long, char) in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
writeToFile(Game&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in main-cd1c38.o
_main in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
writeToFile(Game&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in main-cd1c38.o
_main in main-cd1c38.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in main-cd1c38.o
Game::~Game() in main-cd1c38.o
Move::~Move() in main-cd1c38.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in main-cd1c38.o
"std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(int&)", referenced from:
_main in main-cd1c38.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in main-cd1c38.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in main-cd1c38.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-cd1c38.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-cd1c38.o
"std::__1::cin", referenced from:
_main in main-cd1c38.o
"std::__1::cout", referenced from:
playGame(Game&) in main-cd1c38.o
_main in main-cd1c38.o
"std::__1::ctype<char>::id", referenced from:
std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in main-cd1c38.o
"std::__1::locale::~locale()", referenced from:
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in main-cd1c38.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-cd1c38.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::ios_base::setstate(unsigned int) in main-cd1c38.o
"std::__1::to_string(int)", referenced from:
_main in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
_main in main-cd1c38.o
"std::terminate()", referenced from:
___clang_call_terminate in main-cd1c38.o
"operator delete(void*)", referenced from:
_main in main-cd1c38.o
std::__1::_DeallocateCaller::__do_call(void*) in main-cd1c38.o
"operator new(unsigned long)", referenced from:
_main in main-cd1c38.o
"___cxa_begin_catch", referenced from:
___clang_call_terminate in main-cd1c38.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-cd1c38.o
"___cxa_call_unexpected", referenced from:
std::__1::__vector_base<Move, std::__1::allocator<Move> >::__destruct_at_end(Move*) in main-cd1c38.o
std::__1::allocator<Move>::deallocate(Move*, unsigned long) in main-cd1c38.o
std::__1::__vector_base<LogItem, std::__1::allocator<LogItem> >::__destruct_at_end(LogItem*) in main-cd1c38.o
std::__1::allocator<LogItem>::deallocate(LogItem*, unsigned long) in main-cd1c38.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in main-cd1c38.o
"___cxa_end_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-cd1c38.o
"___gxx_personality_v0", referenced from:
writeToFile(Game&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in main-cd1c38.o
_main in main-cd1c38.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in main-cd1c38.o
Game::~Game() in main-cd1c38.o
std::__1::__vector_base<Move, std::__1::allocator<Move> >::__destruct_at_end(Move*) in main-cd1c38.o
std::__1::allocator<Move>::deallocate(Move*, unsigned long) in main-cd1c38.o
std::__1::__vector_base<LogItem, std::__1::allocator<LogItem> >::__destruct_at_end(LogItem*) in main-cd1c38.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: *** [main.o] Error 1
Process finished with exit code 2
I have figured out that perhaps the undefined deconstructors is an aspect of this, but it seems to me that this would have been a problem to the creators of the repo so I also figure that there is some simple file trick I have to do for the makefile in order to have it compile
for quick reference, heres the makefile:
CXX=g++
CXXFLAGS= -std=c++0x -Wall -pedantic
LDFLAGS=
SOURCES=main.cpp BigMoneyAI.cpp CardManager.cpp Game.cpp GameState.cpp HumanInputAI.cpp Move.cpp Node.cpp Player.cpp PlayerState.cpp UCTMonteCarlo.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=dominionuct
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $#
.cpp.o:
$(CC) $(CFLAGS) $< -o $#
I'm at a bit of a loss where to go with this, any help or tips to investigate would be much appreciated!
Thanks!
I am trying to run this example (from: https://theboostcpplibraries.com/boost.serialization-archive#ex.serialization_01):
#include <boost/archive/text_oarchive.hpp>
#include <iostream>
using namespace boost::archive;
int main()
{
text_oarchive oa{std::cout};
int i = 1;
oa << i;
}
With the command:
gcc -L"/usr/local/include/" test.cpp
And I am getting the following back:
Undefined symbols for architecture x86_64:
"boost::locale::base_message_format<char>::id", referenced from:
boost::locale::basic_message<char>::write(std::__1::locale const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const in test-e8c2b0.o
"boost::locale::details::format_parser::get_position()", referenced from:
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
"boost::locale::details::format_parser::set_one_flag(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&)", referenced from:
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
"boost::locale::details::format_parser::restore()", referenced from:
boost::locale::basic_format<char>::format_guard::restore() in test-e8c2b0.o
"boost::locale::details::format_parser::format_parser(std::__1::ios_base&, void*, void (*)(void*, std::__1::locale const&))", referenced from:
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
"boost::locale::details::format_parser::~format_parser()", referenced from:
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
"boost::locale::ios_info::display_flags(unsigned long long)", referenced from:
boost::locale::as::number(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::currency(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::date(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::time(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::strftime(std::__1::ios_base&) in test-e8c2b0.o
"boost::locale::ios_info::date_time_pattern_set()", referenced from:
void boost::locale::ios_info::date_time_pattern<char>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in test-e8c2b0.o
"boost::locale::ios_info::get(std::__1::ios_base&)", referenced from:
boost::locale::as::number(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::currency(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::date(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::time(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
void boost::locale::details::format_parser::set_flag_with_str<char>(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 test-e8c2b0.o
boost::locale::as::strftime(std::__1::ios_base&) in test-e8c2b0.o
...
"boost::locale::converter<char>::id", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_upper<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_lower<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_title<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::fold_case<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
"boost::locale::generator::generator()", referenced from:
_main in test-e8c2b0.o
"boost::locale::generator::~generator()", referenced from:
_main in test-e8c2b0.o
"boost::locale::ios_info::domain_id() const", referenced from:
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
"boost::locale::generator::generate(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
boost::locale::generator::operator()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const", referenced from:
void boost::locale::details::format_parser::set_flag_with_str<char>(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 test-e8c2b0.o
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
void std::__1::vector<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> > >::__push_back_slow_path<boost::locale::details::formattible<char> const>(boost::locale::details::formattible<char> const&) in test-e8c2b0.o
"std::__1::locale::has_facet(std::__1::locale::id&) const", referenced from:
boost::locale::basic_message<char>::write(std::__1::locale const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const in test-e8c2b0.o
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_upper<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_lower<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_title<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::fold_case<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
boost::locale::basic_message<char>::write(std::__1::locale const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
...
"std::__1::ios_base::getloc() const", referenced from:
_main in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
boost::locale::basic_format<char>::imbue_locale(void*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::logic_error::logic_error(char const*)", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"std::length_error::~length_error()", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
_main in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*)", referenced from:
boost::locale::basic_message<char>::str(std::__1::locale const&, int) const in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)", referenced from:
boost::locale::details::string_cast_traits<char>::cast(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
boost::locale::details::string_cast_traits<char>::cast(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
boost::locale::basic_format<char>::basic_format(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
_main in test-e8c2b0.o
boost::locale::basic_format<char>::~basic_format() in test-e8c2b0.o
boost::locale::basic_message<char>::~basic_message() in test-e8c2b0.o
boost::locale::basic_format<char>::basic_format(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test-e8c2b0.o
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
boost::locale::basic_message<char>::str(std::__1::locale const&, int) const in test-e8c2b0.o
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(double)", referenced from:
_main in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(long)", referenced from:
_main in test-e8c2b0.o
void boost::locale::details::formattible<char>::write<long>(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, void const*) in test-e8c2b0.o
"std::__1::cout", referenced from:
_main in test-e8c2b0.o
"std::__1::ctype<char>::id", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::locale::global(std::__1::locale const&)", referenced from:
_main in test-e8c2b0.o
"std::__1::locale::locale(std::__1::locale const&)", referenced from:
_main in test-e8c2b0.o
boost::locale::basic_format<char>::imbue_locale(void*, std::__1::locale const&) in test-e8c2b0.o
"std::__1::locale::locale()", referenced from:
_main in test-e8c2b0.o
"std::__1::locale::~locale()", referenced from:
_main in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
boost::locale::basic_format<char>::imbue_locale(void*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::locale::operator=(std::__1::locale const&)", referenced from:
_main in test-e8c2b0.o
boost::locale::basic_format<char>::imbue_locale(void*, std::__1::locale const&) in test-e8c2b0.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::ios_base::imbue(std::__1::locale const&)", referenced from:
_main in test-e8c2b0.o
boost::locale::basic_format<char>::imbue_locale(void*, std::__1::locale const&) in test-e8c2b0.o
"std::terminate()", referenced from:
___clang_call_terminate in test-e8c2b0.o
"typeinfo for std::length_error", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"typeinfo for char", referenced from:
void boost::locale::ios_info::string_set::set<char>(char const*) in test-e8c2b0.o
"vtable for std::length_error", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"operator delete[](void*)", referenced from:
void boost::locale::ios_info::string_set::set<char>(char const*) in test-e8c2b0.o
"operator delete(void*)", referenced from:
std::__1::__vector_base<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> > >::~__vector_base() in test-e8c2b0.o
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::~__split_buffer() in test-e8c2b0.o
"operator new[](unsigned long)", referenced from:
void boost::locale::ios_info::string_set::set<char>(char const*) in test-e8c2b0.o
"operator new(unsigned long)", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"___cxa_allocate_exception", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"___cxa_begin_catch", referenced from:
___clang_call_terminate in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
boost::locale::basic_format<char>::format_guard::~format_guard() in test-e8c2b0.o
"___cxa_call_unexpected", referenced from:
boost::locale::basic_message<char>::write(std::__1::locale const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const in test-e8c2b0.o
void boost::locale::details::format_parser::set_flag_with_str<char>(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 test-e8c2b0.o
"___cxa_end_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
boost::locale::basic_format<char>::format_guard::~format_guard() in test-e8c2b0.o
"___cxa_free_exception", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"___cxa_throw", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"___gxx_personality_v0", referenced from:
_main in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
boost::locale::basic_format<char>::~basic_format() in test-e8c2b0.o
boost::locale::basic_message<char>::~basic_message() in test-e8c2b0.o
boost::locale::basic_format<char>::basic_format(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test-e8c2b0.o
void std::__1::vector<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> > >::__push_back_slow_path<boost::locale::details::formattible<char> const>(boost::locale::details::formattible<char> const&) in test-e8c2b0.o
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Not sure why I am getting a clang error when I am using gcc and why there is an error with 86_64.
Edit: with adding the commands recommended by #walnut now I am getting:
Desktop $ gcc -L"/usr/local/include/" test.cpp -lboost_serialization -lboost_locale
ld: library not found for -lboost_serialization
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm beginning to learn how to use GTest to test a few Cpp and C libraries:
https://github.com/google/googletest
I'm trying out GTest on my macbook, with g++ version
$ g++ --version
g++ (Homebrew GCC 4.9.4_1) 4.9.4
Copyright (C) 2015 Free Software Foundation, Inc.
The installation appears successfully, e.g. after sudo make install:
...
-- Installing: /usr/local/lib/libgtest.a
-- Installing: /usr/local/lib/libgtest_main.a
...
I've been following this tutorial from a few months ago, https://www.youtube.com/watch?v=nbFXI9SDfbk
Here is the minimal working example:
#include <iostream>
#include <gtest/gtest.h>
using namespace std;
int main(int argc, char **argv){
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Here is how it's recommended to be compiled:
$ g++ Test.cpp -lgtest -lgtest_main -pthread
Above, the libraries are there, and this version of g++ should have -pthread capabilities built in. I get a massive linking error, for reasons I don't understand. Is there an obvious reason why the linking isn't working?
Here's the error, truncated for size:
$ g++ Test.cpp -lgtest -lgtest_main -pthread
/var/folders/1d/_h9qdvds6l5d7x78b21pn1_45n_16x/T//ccYIGdBL.s:7:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/1d/_h9qdvds6l5d7x78b21pn1_45n_16x/T//ccYIGdBL.s:7:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
Undefined symbols for architecture x86_64:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find(char, unsigned long) const", referenced from:
testing::internal::SplitString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*) in libgtest.a(gtest-all.cc.o)
testing::internal::FormatDeathTestOutput(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const", referenced from:
testing::internal::EqFailure(char const*, char const*, 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&, bool) in libgtest.a(gtest-all.cc.o)
testing::GetReservedAttributesForElement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestImpl::ConfigureXmlOutput() in libgtest.a(gtest-all.cc.o)
void testing::internal::ParseGoogleTestFlagsOnlyImpl<char>(int*, char**) in libgtest.a(gtest-all.cc.o)
void testing::internal::ParseGoogleTestFlagsOnlyImpl<wchar_t>(int*, wchar_t**) in libgtest.a(gtest-all.cc.o)
testing::internal::InDeathTestChild() in libgtest.a(gtest-all.cc.o)
testing::internal::DefaultDeathTestFactory::Create(char const*, testing::internal::RE const*, char const*, int, testing::internal::DeathTest**) in libgtest.a(gtest-all.cc.o)
...
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
std::__1::vector<testing::TestCase*, std::__1::allocator<testing::TestCase*> >::insert(std::__1::__wrap_iter<testing::TestCase* const*>, testing::TestCase* const&) in libgtest.a(gtest-all.cc.o)
std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
void std::__1::vector<char*, std::__1::allocator<char*> >::__push_back_slow_path<char* const>(char* const&) in libgtest.a(gtest-all.cc.o)
std::__1::vector<char*, std::__1::allocator<char*> >::insert(std::__1::__wrap_iter<char* const*>, char* const&) in libgtest.a(gtest-all.cc.o)
void std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::__push_back_slow_path<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 libgtest.a(gtest-all.cc.o)
std::__1::vector<double, std::__1::allocator<double> >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
std::__1::vector<std::__1::vector<double, std::__1::allocator<double> >, std::__1::allocator<std::__1::vector<double, std::__1::allocator<double> > > >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
...
"std::__1::__vector_base_common<true>::__throw_out_of_range() const", referenced from:
std::__1::vector<testing::TestPartResult, std::__1::allocator<testing::TestPartResult> >::at(unsigned long) const in libgtest.a(gtest-all.cc.o)
std::__1::vector<testing::TestProperty, std::__1::allocator<testing::TestProperty> >::at(unsigned long) const in libgtest.a(gtest-all.cc.o)
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPKcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_ in libgtest.a(gtest-all.cc.o)
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES9_S9_ in libgtest.a(gtest-all.cc.o)
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in libgtest.a(gtest-all.cc.o)
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in libgtest.a(gtest-all.cc.o)
"std::logic_error::logic_error(char const*)", referenced from:
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned long, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, unsigned long> > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
std::__1::list<std::__1::pair<char, char const*>, std::__1::allocator<std::__1::pair<char, char const*> > >::push_back(std::__1::pair<char, char const*> const&) in libgtest.a(gtest-all.cc.o)
std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
std::__1::__split_buffer<char*, std::__1::allocator<char*>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<char*>&) in libgtest.a(gtest-all.cc.o)
std::__1::__split_buffer<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&) in libgtest.a(gtest-all.cc.o)
std::__1::vector<double, std::__1::allocator<double> >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
std::__1::vector<std::__1::vector<double, std::__1::allocator<double> >, std::__1::allocator<std::__1::vector<double, std::__1::allocator<double> > > >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
...
"std::runtime_error::runtime_error(char const*)", referenced from:
testing::internal::GoogleTestFailureException::GoogleTestFailureException(testing::TestPartResult const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::erase(unsigned long, unsigned long)", referenced from:
testing::internal::StripTrailingSpaces(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
testing::internal::OutputFlagAlsoCheckEnvVar() in libgtest.a(gtest-all.cc.o)
testing::internal::FilePath::RemoveDirectoryName() const in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestOptions::GetOutputFormat() in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestOptions::GetAbsolutePathToOutputFile() in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestOptions::FilterMatchesTest(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 libgtest.a(gtest-all.cc.o)
testing::internal::HasOneFailure(char const*, char const*, char const*, testing::TestPartResultArray const&, testing::TestPartResult::Type, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::internal::String::ShowWideCString(wchar_t const*) in libgtest.a(gtest-all.cc.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(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 libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
testing::internal::Indent(int) in libgtest.a(gtest-all.cc.o)
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)", referenced from:
testing::internal::StringStreamToString(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in libgtest.a(gtest-all.cc.o)
testing::internal::FormatDeathTestOutput(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::AssertionResult::AppendMessage(testing::Message const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(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 libgtest.a(gtest-all.cc.o)
testing::internal::FormatDeathTestOutput(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*)", referenced from:
testing::internal::UnitTestOptions::FilterMatchesTest(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 libgtest.a(gtest-all.cc.o)
testing::internal::FilePath::RemoveFileName() const in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestImpl::RecordProperty(testing::TestProperty const&) in libgtest.a(gtest-all.cc.o)
testing::internal::FilePath::Normalize() in libgtest.a(gtest-all.cc.o)
testing::internal::CapturedStream::CapturedStream(int) in libgtest.a(gtest-all.cc.o)
bool testing::internal::ParseStringFlag<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::resize(unsigned long, char)", referenced from:
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in libgtest.a(gtest-all.cc.o)
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)", referenced from:
testing::internal::StringStreamToString(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in libgtest.a(gtest-all.cc.o)
testing::internal::XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
testing::internal::StringStreamToString(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in libgtest.a(gtest-all.cc.o)
testing::internal::XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char) in libgtest.a(gtest-all.cc.o)
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
testing::internal::AppendUserMessage(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, testing::Message const&) in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestOptions::GetAbsolutePathToOutputFile() in libgtest.a(gtest-all.cc.o)
testing::internal::SingleFailureChecker::SingleFailureChecker(testing::TestPartResultArray const*, testing::TestPartResult::Type, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::internal::SplitString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*) in libgtest.a(gtest-all.cc.o)
testing::AssertionResult::AssertionResult(testing::AssertionResult const&) in libgtest.a(gtest-all.cc.o)
testing::internal::(anonymous namespace)::SplitEscapedString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::TestInfo::TestInfo(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&, char const*, char const*, testing::internal::CodeLocation, void const*, testing::internal::TestFactoryBase*) in libgtest.a(gtest-all.cc.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long, std::__1::allocator<char> const&)", referenced from:
testing::internal::SplitString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*) in libgtest.a(gtest-all.cc.o)
....
"virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libgtest.a(gtest-all.cc.o)
"virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libgtest.a(gtest-all.cc.o)
"virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libgtest.a(gtest-all.cc.o)
"virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libgtest.a(gtest-all.cc.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
#include <map>
#include <fstream>
#include <string>
#include <stdexcept>
using std::string;
using std::map;
using std::ifstream;
map<string, string> buildMap(ifstream &map_file)
{
map<string, string> trans_map;
string key;
string value;
while (map_file >> key && getline(map_file, value))
if (value.size() > 1)
trans_map[key] = value.substr(1);
else
throw runtime_error("no rule for " + key);
return trans_map;
}
int main()
{
return 0;
}
the error is
cppMapTest.cpp:19:19: error: use of undeclared identifier 'runtime_error'
throw runtime_error("no rule for " + key);
but when I add using std::runtime_error;,the error is
Undefined symbols for architecture x86_64:
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
"std::__1::ios_base::getloc() const", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
"std::runtime_error::runtime_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"std::runtime_error::~runtime_error()", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<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> > > > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long, std::__1::allocator<char> const&)", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<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> > > > >::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::pair<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> > >::~pair() in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<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> > > > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"std::__1::basic_istream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_istream<char, std::__1::char_traits<char> >&, bool)", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"std::__1::ctype<char>::id", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
"std::__1::locale::~locale()", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"std::terminate()", referenced from:
___clang_call_terminate in cppMapTest-1b8776.o
"typeinfo for std::runtime_error", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"operator delete(void*)", referenced from:
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<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> > > > >::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, void*>*) in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<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> > > > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"operator new(unsigned long)", referenced from:
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<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> > > > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"___cxa_allocate_exception", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"___cxa_begin_catch", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
___clang_call_terminate in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"___cxa_call_unexpected", referenced from:
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<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> > > > >::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, void*>*) in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<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> > > > >::__find_equal_key(std::__1::__tree_node_base<void*>*&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<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> > > > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"___cxa_end_catch", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"___cxa_free_exception", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"___cxa_throw", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"___gxx_personality_v0", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<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> > > > >::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, void*>*) in cppMapTest-1b8776.o
std::__1::pair<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> > >::~pair() in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I programme on mac terminal with vim,compiler is clang-clang cppMapTest.cpp -o cppMapTest.exe
I want to know why,thank you.
You already figured out how to avoid the runtime_error error (using std::runtime_error;).
The linker errors can be fixed by compiling with clang++.
When compiling with clang, your compiler only links against the C libraries, not the C++ ones.
I have compiled Poco as static library to be used in an XCode6.1.1 Project. However I see linking error for libraries: libPocoCrypto.a and libPocoNetSSL.a:
I have already verified that these libraries are built for x86_64 architecture:
input file libPocoCrypto.a is not a fat file
Non-fat file: libPocoCrypto.a is architecture: x86_64
What could be wrong? Any help would be appreciable?
Linker Error:
Undefined symbols for architecture x86_64:
"_ASN1_STRING_data", referenced from:
Poco::Crypto::X509Certificate::extractNames(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&) const in libPocoCryptod.a(X509Certificate.o)
"_ASN1_STRING_length", referenced from:
Poco::Crypto::X509Certificate::extractNames(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&) const in libPocoCryptod.a(X509Certificate.o)
"_BIO_ctrl", referenced from:
Poco::Crypto::X509Certificate::load(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libPocoCryptod.a(X509Certificate.o)
Poco::Crypto::X509Certificate::save(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in libPocoCryptod.a(X509Certificate.o)
Poco::Crypto::X509Certificate::save(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in libPocoCryptod.a(X509Certificate.o)
"_BIO_free", referenced from:
Poco::Net::SecureSocketImpl::acceptSSL() in libPocoNetSSLd.a(SecureSocketImpl.o)
Poco::Net::SecureSocketImpl::connectSSL(bool) in libPocoNetSSLd.a(SecureSocketImpl.o)
Poco::Crypto::X509Certificate::load(std::__1::basic_istream<char, std::__1::char_traits<char> >&) in libPocoCryptod.a(X509Certificate.o)
Poco::Crypto::X509Certificate::load(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libPocoCryptod.a(X509Certificate.o)
Poco::Crypto::X509Certificate::save(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in libPocoCryptod.a(X509Certificate.o)
Poco::Crypto::X509Certificate::save(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in libPocoCryptod.a(X509Certificate.o)
"_BIO_int_ctrl", referenced from:
Poco::Net::SecureSocketImpl::acceptSSL() in libPocoNetSSLd.a(SecureSocketImpl.o)
Poco::Net::SecureSocketImpl::connectSSL(bool) in libPocoNetSSLd.a(SecureSocketImpl.o)
"_BIO_new", referenced from:
Poco::Net::SecureSocketImpl::acceptSSL() in libPocoNetSSLd.a(SecureSocketImpl.o)
Poco::Net::SecureSocketImpl::connectSSL(bool) in libPocoNetSSLd.a(SecureSocketImpl.o)
Poco::Crypto::X509Certificate::load(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libPocoCryptod.a(X509Certificate.o)
Poco::Crypto::X509Certificate::save(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in libPocoCryptod.a(X509Certificate.o)
Poco::Crypto::X509Certificate::save(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in libPocoCryptod.a(X509Certificate.o)
"_BIO_new_mem_buf", referenced from:
Poco::Crypto::X509Certificate::load(std::__1::basic_istream<char, std::__1::char_traits<char> >&) in libPocoCryptod.a(X509Certificate.o)
"_BIO_s_file", referenced from:
Poco::Crypto::X509Certificate::load(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libPocoCryptod.a(X509Certificate.o)
"_SSL_CTX_use_PrivateKey_file", referenced from:
Poco::Net::Context::Context(Poco::Net::Context::Usage, 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&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::Net::Context::VerificationMode, int, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libPocoNetSSLd.a(Context.o)