Related
I am completely new to C++, working on Linux or compiling in general. I have a code done by another fellow scientist and I am trying to compile and link his work using his own Makefile. Nevertheless, I get an error regarding undefined references...
The Makefile is
#CC = g++
CC = mpicxx
#CPPFLAGS = -I ../../include -g
#LDFLAGS = -lboost_program_options -g
CPPFLAGS = -I ../../include -O3
LDFLAGS = -lboost_program_options -lboost_mpi -lboost_serialization -O3
BUILD = ../../build/
vpath %.h ../../include
#vpath %.cpp src
TARGET = calc_num_walks
all: $(TARGET)
$(TARGET): calc_num_walks.o $(BUILD)origami_system.o $(BUILD)utility.o $(BUILD)nearest_neighbour.o $(BUILD)files.o $(BUILD)jsoncpp.o $(BUILD)domain.o $(BUILD)simulation.o $(BUILD)parser.o $(BUILD)random_gens.o $(BUILD)movetypes.o $(BUILD)ideal_random_walk.o
$(CC) -o $# $^ $(LDFLAGS)
calc_num_walks.o: calc_num_walks.cpp
$(CC) -c $^ $(CPPFLAGS)
clean:
rm *.o
Now this is the output I receive after running the Makefile:
mpicxx -o calc_num_walks calc_num_walks.o ../../build/origami_system.o ../../build/utility.o ../../build/nearest_neighbour.o ../../build/files.o ../../build/jsoncpp.o ../../build/domain.o ../../build/simulation.o ../../build/parser.o ../../build/random_gens.o ../../build/movetypes.o ../../build/ideal_random_walk.o -lboost_program_options -lboost_mpi -lboost_serialization -O3
/usr/bin/x86_64-linux-gnu-ld: calc_num_walks.o: in function `boost::archive::detail::common_oarchive<boost::archive::binary_oarchive>::vsave(boost::archive::class_name_type const&)':
calc_num_walks.cpp:(.text._ZN5boost7archive6detail15common_oarchiveINS0_15binary_oarchiveEE5vsaveERKNS0_15class_name_typeE[_ZN5boost7archive6detail15common_oarchiveINS0_15binary_oarchiveEE5vsaveERKNS0_15class_name_typeE]+0x43): undefined reference to `boost::archive::basic_binary_oprimitive<boost::archive::binary_oarchive, char, std::char_traits<char> >::save(std::string const&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::OrigamiSystem(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::allocator<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&, std::vector<double, std::allocator<double> >, std::vector<double, std::allocator<double> >, std::vector<origami::Chain, std::allocator<origami::Chain> > const&, bool, double, parser::InputParameters&)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:63: undefined reference to `potential::OrigamiPotential::OrigamiPotential(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::vector<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::allocator<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&, std::vector<double, std::allocator<double> >, std::vector<double, std::allocator<double> >, parser::InputParameters&)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:63: undefined reference to `potential::OrigamiPotential::~OrigamiPotential()'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::~OrigamiSystem()':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:74: undefined reference to `potential::OrigamiPotential::~OrigamiPotential()'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::check_domains_complementary(domainContainer::Domain&, domainContainer::Domain&)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:136: undefined reference to `potential::OrigamiPotential::check_domains_complementary(domainContainer::Domain&, domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::update_enthalpy_and_entropy()':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:218: undefined reference to `potential::OrigamiPotential::hybridization_enthalpy(domainContainer::Domain const&, domainContainer::Domain const&) const'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:220: undefined reference to `potential::OrigamiPotential::hybridization_entropy(domainContainer::Domain const&, domainContainer::Domain const&) const'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:242: undefined reference to `potential::OrigamiPotential::init_enthalpy() const'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:243: undefined reference to `potential::OrigamiPotential::init_entropy() const'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::init_energy()':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:265: undefined reference to `potential::OrigamiPotential::init_energy() const'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::check_all_constraints()':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:293: undefined reference to `potential::OrigamiPotential::init_energy() const'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:324: undefined reference to `potential::OrigamiPotential::init_energy() const'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::add_chain(int)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:397: undefined reference to `potential::OrigamiPotential::init_energy() const'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::delete_chain(int)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:471: undefined reference to `potential::OrigamiPotential::init_energy() const'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::set_checked_domain_config(domainContainer::Domain&, utility::VectorThree, utility::VectorThree)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:490: undefined reference to `potential::OrigamiPotential::hybridization_energy(domainContainer::Domain const&, domainContainer::Domain const&) const'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:493: undefined reference to `potential::OrigamiPotential::hybridization_energy(domainContainer::Domain const&, domainContainer::Domain const&) const'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:495: undefined reference to `potential::OrigamiPotential::check_stacking(domainContainer::Domain&, domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::update_temp(double, double)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:620: undefined reference to `potential::OrigamiPotential::update_temp(double, double)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::initialize_staples(std::vector<origami::Chain, std::allocator<origami::Chain> >)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:673: undefined reference to `potential::OrigamiPotential::init_energy() const'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::internal_unassign_domain(domainContainer::Domain&)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:704: undefined reference to `potential::OrigamiPotential::check_stacking(domainContainer::Domain&, domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::unassign_bound_domain(domainContainer::Domain&)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:743: undefined reference to `potential::OrigamiPotential::hybridization_energy(domainContainer::Domain const&, domainContainer::Domain const&) const'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::update_energy()':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:824: undefined reference to `potential::OrigamiPotential::init_energy() const'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystem::internal_check_domain_constraints(domainContainer::Domain&, utility::VectorThree, utility::VectorThree)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:850: undefined reference to `potential::OrigamiPotential::bind_domain(domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystemWithBias::check_domain_constraints(domainContainer::Domain&, utility::VectorThree, utility::VectorThree)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:907: undefined reference to `potential::OrigamiPotential::check_domains_complementary(domainContainer::Domain&, domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:918: undefined reference to `orderParams::SystemOrderParams::check_one_domain(domainContainer::Domain&, utility::VectorThree, utility::VectorThree, utility::Occupancy)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:919: undefined reference to `biasFunctions::SystemBiases::check_one_domain(domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystemWithBias::unassign_domain(domainContainer::Domain&)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:931: undefined reference to `orderParams::SystemOrderParams::update_one_domain(domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:932: undefined reference to `biasFunctions::SystemBiases::calc_one_domain(domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystemWithBias::set_checked_domain_config(domainContainer::Domain&, utility::VectorThree, utility::VectorThree)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:944: undefined reference to `orderParams::SystemOrderParams::update_one_domain(domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/origami_system.cpp:945: undefined reference to `biasFunctions::SystemBiases::calc_one_domain(domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `origami::OrigamiSystemWithBias::set_domain_config(domainContainer::Domain&, utility::VectorThree, utility::VectorThree)':
/home/jakub/LatticeDNAOrigami/src/origami_system.cpp:955: undefined reference to `biasFunctions::SystemBiases::calc_one_domain(domainContainer::Domain&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `std::_MakeUniq<orderParams::SystemOrderParams>::__single_object std::make_unique<orderParams::SystemOrderParams, parser::InputParameters&, origami::OrigamiSystem&>(parser::InputParameters&, origami::OrigamiSystem&)':
/usr/include/c++/6/bits/unique_ptr.h:795: undefined reference to `orderParams::SystemOrderParams::SystemOrderParams(parser::InputParameters&, origami::OrigamiSystem&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/origami_system.o: in function `std::_MakeUniq<biasFunctions::SystemBiases>::__single_object std::make_unique<biasFunctions::SystemBiases, origami::OrigamiSystem&, orderParams::SystemOrderParams&, parser::InputParameters&>(origami::OrigamiSystem&, orderParams::SystemOrderParams&, parser::InputParameters&)':
/usr/include/c++/6/bits/unique_ptr.h:795: undefined reference to `biasFunctions::SystemBiases::SystemBiases(origami::OrigamiSystem&, orderParams::SystemOrderParams&, parser::InputParameters&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/files.o: in function `files::OrigamiEnergiesOutputFile::write(long, double)':
/home/jakub/LatticeDNAOrigami/src/files.cpp:652: undefined reference to `biasFunctions::SystemBiases::get_total_bias()'
/usr/bin/x86_64-linux-gnu-ld: ../../build/files.o: in function `files::OrigamiOrderParamsOutputFile::OrigamiOrderParamsOutputFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int, int, origami::OrigamiSystem&, orderParams::SystemOrderParams&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >)':
/home/jakub/LatticeDNAOrigami/src/files.cpp:695: undefined reference to `orderParams::SystemOrderParams::get_order_param(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `simulation::GCMCSimulation::setup_orientation_movetype(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, files::OrigamiMovetypeFile&, movetypes::MCMovetype*)':
/home/jakub/LatticeDNAOrigami/src/simulation.cpp:305: undefined reference to `movetypes::OrientationRotationMCMovetype::OrientationRotationMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `simulation::GCMCSimulation::setup_staple_exchange_movetype(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, files::OrigamiMovetypeFile&, movetypes::MCMovetype*)':
/home/jakub/LatticeDNAOrigami/src/simulation.cpp:331: undefined reference to `movetypes::MetStapleExchangeMCMovetype::MetStapleExchangeMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&, std::vector<double, std::allocator<double> >, bool)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `simulation::GCMCSimulation::setup_staple_regrowth_movetype(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, files::OrigamiMovetypeFile&, movetypes::MCMovetype*)':
/home/jakub/LatticeDNAOrigami/src/simulation.cpp:352: undefined reference to `movetypes::MetStapleRegrowthMCMovetype::MetStapleRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/simulation.cpp:363: undefined reference to `movetypes::CBStapleRegrowthMCMovetype::CBStapleRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `simulation::GCMCSimulation::setup_scaffold_regrowth_movetype(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, files::OrigamiMovetypeFile&, movetypes::MCMovetype*)':
/home/jakub/LatticeDNAOrigami/src/simulation.cpp:391: undefined reference to `movetypes::CTCBScaffoldRegrowthMCMovetype::CTCBScaffoldRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&, int, int)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/simulation.cpp:407: undefined reference to `movetypes::CTCBJumpScaffoldRegrowthMCMovetype::CTCBJumpScaffoldRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&, int, int, int)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `simulation::GCMCSimulation::setup_scaffold_transform_movetype(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, files::OrigamiMovetypeFile&, movetypes::MCMovetype*)':
/home/jakub/LatticeDNAOrigami/src/simulation.cpp:442: undefined reference to `movetypes::CTCBLinkerRegrowthMCMovetype::CTCBLinkerRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&, int, int, int, unsigned int, unsigned int, int)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/simulation.cpp:458: undefined reference to `movetypes::CTCBClusteredLinkerRegrowthMCMovetype::CTCBClusteredLinkerRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&, int, int, int, unsigned int, int)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/simulation.cpp:480: undefined reference to `movetypes::CTRGLinkerRegrowthMCMovetype::CTRGLinkerRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&, int, int, int, int, int, unsigned int, unsigned int, int)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `simulation::GCMCSimulation::setup_rg_movetype(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, files::OrigamiMovetypeFile&, movetypes::MCMovetype*)':
/home/jakub/LatticeDNAOrigami/src/simulation.cpp:512: undefined reference to `movetypes::CTRGScaffoldRegrowthMCMovetype::CTRGScaffoldRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&, int, int, int, int)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/simulation.cpp:530: undefined reference to `movetypes::CTRGJumpScaffoldRegrowthMCMovetype::CTRGJumpScaffoldRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&, int, int, int, int, int)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `simulation::GCMCSimulation::simulate(long long, long long, bool, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > >)':
/home/jakub/LatticeDNAOrigami/src/simulation.cpp:553: undefined reference to `orderParams::SystemOrderParams::update_move_params()'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/simulation.cpp:554: undefined reference to `biasFunctions::SystemBiases::calc_move()'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `simulation::GCMCSimulation::write_log_entry(long long, bool, movetypes::MCMovetype&)':
/home/jakub/LatticeDNAOrigami/src/simulation.cpp:657: undefined reference to `biasFunctions::SystemBiases::get_total_bias()'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/simulation.cpp:660: undefined reference to `biasFunctions::SystemBiases::get_domain_update_bias()'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/simulation.cpp:662: undefined reference to `biasFunctions::SystemBiases::get_move_update_bias()'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `boost::system::error_code::error_code()':
/usr/include/boost/system/error_code.hpp:461: undefined reference to `boost::system::system_category()'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `boost::system::error_category::std_category::equivalent(int, std::error_condition const&) const':
/usr/include/boost/system/error_code.hpp:703: undefined reference to `boost::system::generic_category()'
/usr/bin/x86_64-linux-gnu-ld: /usr/include/boost/system/error_code.hpp:706: undefined reference to `boost::system::generic_category()'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `boost::system::error_category::std_category::equivalent(std::error_code const&, int) const':
/usr/include/boost/system/error_code.hpp:733: undefined reference to `boost::system::generic_category()'
/usr/bin/x86_64-linux-gnu-ld: /usr/include/boost/system/error_code.hpp:736: undefined reference to `boost::system::generic_category()'
/usr/bin/x86_64-linux-gnu-ld: /usr/include/boost/system/error_code.hpp:748: undefined reference to `boost::system::generic_category()'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `boost::filesystem::operator/(boost::filesystem::path const&, boost::filesystem::path const&)':
/usr/include/boost/filesystem/path.hpp:792: undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `boost::asio::error::get_system_category()':
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `boost::filesystem::is_regular_file(boost::filesystem::path const&, boost::system::error_code&)':
/usr/include/boost/filesystem/operations.hpp:459: undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/simulation.o: in function `std::hash<std::pair<utility::VectorThree, int> >::operator()(std::pair<utility::VectorThree, int> const&) const':
/home/jakub/LatticeDNAOrigami/include/hash.h:90: undefined reference to `std::hash_value(utility::VectorThree const&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/movetypes.o: in function `movetypes::CTRegrowthMCMovetype::CTRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&, int, int, int)':
/home/jakub/LatticeDNAOrigami/src/movetypes.cpp:441: undefined reference to `topConstraintPoints::Constraintpoints::Constraintpoints(origami::OrigamiSystem&, idealRandomWalk::IdealRandomWalks&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/movetypes.o: in function `movetypes::CTRegrowthMCMovetype::CTRegrowthMCMovetype(origami::OrigamiSystem&, randomGen::RandomGens&, idealRandomWalk::IdealRandomWalks&, std::vector<files::OrigamiOutputFile*, std::allocator<files::OrigamiOutputFile*> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, orderParams::SystemOrderParams&, biasFunctions::SystemBiases&, parser::InputParameters&, int, int, int)':
/home/jakub/LatticeDNAOrigami/src/movetypes.cpp:441: undefined reference to `topConstraintPoints::Constraintpoints::Constraintpoints(origami::OrigamiSystem&, idealRandomWalk::IdealRandomWalks&)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/movetypes.o: in function `movetypes::CTRegrowthMCMovetype::reset_internal()':
/home/jakub/LatticeDNAOrigami/src/movetypes.cpp:447: undefined reference to `topConstraintPoints::Constraintpoints::reset_internal()'
/usr/bin/x86_64-linux-gnu-ld: ../../build/movetypes.o: in function `movetypes::CTRegrowthMCMovetype::select_indices(std::vector<domainContainer::Domain*, std::allocator<domainContainer::Domain*> >, unsigned int, int)':
/home/jakub/LatticeDNAOrigami/src/movetypes.cpp:508: undefined reference to `topConstraintPoints::Constraintpoints::add_active_endpoint(domainContainer::Domain*, utility::VectorThree, int)'
/usr/bin/x86_64-linux-gnu-ld: ../../build/movetypes.o: in function `movetypes::CTRegrowthMCMovetype::select_noncontig_segs(std::vector<domainContainer::Domain*, std::allocator<domainContainer::Domain*> >&, std::vector<std::vector<domainContainer::Domain*, std::allocator<domainContainer::Domain*> >, std::allocator<std::vector<domainContainer::Domain*, std::allocator<domainContainer::Domain*> > > >&, std::vector<std::vector<std::vector<domainContainer::Domain*, std::allocator<domainContainer::Domain*> >, std::allocator<std::vector<domainContainer::Domain*, std::allocator<domainContainer::Domain*> > > >, std::allocator<std::vector<std::vector<domainContainer::Domain*, std::allocator<domainContainer::Domain*> >, std::allocator<std::vector<domainContainer::Domain*, std::allocator<domainContainer::Domain*> > > > > >&, std::vector<domainContainer::Domain*, std::allocator<domainContainer::Domain*> >&, std::vector<int, std::allocator<int> >&)':
/home/jakub/LatticeDNAOrigami/src/movetypes.cpp:624: undefined reference to `topConstraintPoints::Constraintpoints::add_active_endpoint(domainContainer::Domain*, utility::VectorThree, int)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/movetypes.cpp:631: undefined reference to `topConstraintPoints::Constraintpoints::add_growthpoint(domainContainer::Domain*, domainContainer::Domain*)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/movetypes.cpp:632: undefined reference to `topConstraintPoints::Constraintpoints::add_stem_seg_pair(domainContainer::Domain*, std::vector<int, std::allocator<int> >)'
/usr/bin/x86_64-linux-gnu-ld: /home/jakub/LatticeDNAOrigami/src/movetypes.cpp:645: undefined reference to `topConstraintPoints::Constraintpoints::add_active_endpoint(domainContainer::Domain*, utility::VectorThree, int)'
collect2: error: ld returned 1 exit status
Makefile:16: recipe for target 'calc_num_walks' failed
make: *** [calc_num_walks] Error 1
Now I have tried many solutions posted online, but none of them was successful. I have read about the different version of GCC used for the different objects I create, although I believe I use the same versions for everything.
I have tried to link boost in my CMakeList file by
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(Boost_NO_SYSTEM_PATHS TRUE)
set(Boost_INCLUDE_DIR /user/software/boost/boost-1.69-x86_64-cc7/include)
set(Boost_LIBRARY_DIR /user/software/boost/boost-1.69-x86_64-cc7/lib)
find_package(Boost 1.54 REQUIRED COMPONENTS filesystem program_options system)
and i get the following warning when doing cmake
CMake Warning at /user/software/cmake/cmake-3.7.1-x86_64-cc7/share/cmake-3.7/Modules/FindBoost.cmake:744 (message):
Imported targets not available for Boost version 106900
Call Stack (most recent call first):
/user/software/cmake/cmake-3.7.1-x86_64-cc7/share/cmake-3.7/Modules/FindBoost.cmake:848 (_Boost_COMPONENT_DEPENDENCIES)
/user/software/cmake/cmake-3.7.1-x86_64-cc7/share/cmake-3.7/Modules/FindBoost.cmake:1435 (_Boost_MISSING_DEPENDENCIES)
util/src/CMakeLists.txt:21 (find_package)
So when i do the make command i get the error
CMakeFiles/checkFile.dir/checkFile.cpp.o: In function `boost::program_options::typed_value<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, char>::name() const':
checkFile.cpp:(.text._ZNK5boost15program_options11typed_valueISt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEcE4nameEv[_ZNK5boost15program_options11typed_valueISt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEcE4nameEv]+0x25): undefined reference to `boost::program_options::arg[abi:cxx11]'
CMakeFiles/checkFile.dir/checkFile.cpp.o: In function `boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*)':
checkFile.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcEC2EiPKPKc[_ZN5boost15program_options25basic_command_line_parserIcEC5EiPKPKc]+0x112): undefined reference to `boost::program_options::to_internal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
checkFile.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcEC2EiPKPKc[_ZN5boost15program_options25basic_command_line_parserIcEC5EiPKPKc]+0x187): undefined reference to `boost::program_options::detail::cmdline::cmdline(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
CMakeFiles/checkFile.dir/checkFile.cpp.o: In function `main':
checkFile.cpp:(.text.startup+0x63): undefined reference to `boost::program_options::options_description::options_description(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)'
checkFile.cpp:(.text.startup+0x222): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/checkFile.dir/checkFile.cpp.o: In function `void boost::program_options::validate<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char>(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*, int) [clone .constprop.475]':
checkFile.cpp:(.text._ZN5boost15program_options8validateINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEEvRNS_3anyERKSt6vectorINS3_IT0_S4_ISB_ESaISB_EEESaISE_EEPSA_IT_SaISJ_EEi.constprop.475[_ZNK5boost15program_options11typed_valueISt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEcE6xparseERNS_3anyERKSA_]+0xc9): undefined reference to `boost::program_options::validate(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)'
checkFile.cpp:(.text._ZN5boost15program_options8validateINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEEvRNS_3anyERKSt6vectorINS3_IT0_S4_ISB_ESaISB_EEESaISE_EEPSA_IT_SaISJ_EEi.constprop.475[_ZNK5boost15program_options11typed_valueISt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEcE6xparseERNS_3anyERKSA_]+0x4b4): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/checkFile.dir/checkFile.cpp.o:(.data.rel.ro._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/checkFile.dir/checkFile.cpp.o:(.data.rel.ro._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/checkFile.dir/checkFile.cpp.o:(.data.rel.ro._ZTCN5boost10wrapexceptINS_15program_options20invalid_option_valueEEE0_NS_16exception_detail10clone_implINS4_19error_info_injectorIS2_EEEE[_ZTVN5boost10wrapexceptINS_15program_options20invalid_option_valueEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/checkFile.dir/checkFile.cpp.o:(.data.rel.ro._ZTVN5boost10wrapexceptINS_15program_options20invalid_option_valueEEE[_ZTVN5boost10wrapexceptINS_15program_options20invalid_option_valueEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/checkFile.dir/checkFile.cpp.o:(.data.rel.ro._ZTVN5boost15program_options16validation_errorE[_ZTVN5boost15program_options16validation_errorE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/checkFile.dir/checkFile.cpp.o:(.data.rel.ro._ZTVN5boost15program_options20invalid_option_valueE[_ZTVN5boost15program_options20invalid_option_valueE]+0x30): more undefined references to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' follow
CMakeFiles/checkFile.dir/checkFile.cpp.o:(.data.rel.ro._ZTVN5boost15program_options11typed_valueISt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEcEE[_ZTVN5boost15program_options11typed_valueISt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
Any help please would be greatly appreciated
Try compiling your code while defining macro _GLIBCXX_USE_CXX11_ABI=0, e.g.:
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
If you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace or the tag [abi:cxx11] then it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro. This commonly happens when linking to a third-party library that was compiled with an older version of GCC. If the third-party library cannot be rebuilt with the new ABI then you will need to recompile your code with the old ABI.
I am having errors while compiling my C++ code on the server.
So on this particular server the standard g++ installed is version 4.4.6, which I cannot use for my program since I need -std=c++14.
So I use a different version, which is installed in the home directory of another user, which is a version 7.1, called with command g++_71.
Know all the files compile except one class where I make use of the boost program_options.
When just linking to -lboost_program_options, it wouldn't work, because it would link to an old version of boost, that does not support the functionalities I was using, and also was compiled with the 4.4.6 gcc.
Therefore I downloaded boost version 1.66.0 and installed it in my home directory in a folder I named boost. I made sure that boost was installed with the correct toolset g++_71, even if this should not change a thing for a header-only library which program_options is.
Now I still get linker errors :
objlinux/src/Utilities/Options/OptionsParser.o: In function `OptionsParser::parseOptionsFromCommandline(int, char**)':
OptionsParser.cpp:(.text+0x28c2): undefined reference to `boost::program_options::options_description::options_description(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)'
objlinux/src/Utilities/Options/OptionsParser.o: In function `boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
OptionsParser.cpp:(.text._ZN5boost15program_options16validation_errorC2ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i[_ZN5boost15program_options16validation_errorC5ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i]+0x21): undefined reference to `_ZN5boost15program_options16validation_error12get_templateB5cxx11ENS1_6kind_tE'
OptionsParser.cpp:(.text._ZN5boost15program_options16validation_errorC2ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i[_ZN5boost15program_options16validation_errorC5ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i]+0x3b): undefined reference to `boost::program_options::error_with_option_name::error_with_option_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
objlinux/src/Utilities/Options/OptionsParser.o: In function `boost::program_options::typed_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char>::xparse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) const':
OptionsParser.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE6xparseERNS_3anyERKSt6vectorIS7_SaIS7_EE[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE6xparseERNS_3anyERKSt6vectorIS7_SaIS7_EE]+0x17): undefined reference to `boost::program_options::validate(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)'
objlinux/src/Utilities/Options/OptionsParser.o: In function `boost::program_options::typed_value<bool, char>::xparse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) const':
OptionsParser.cpp:(.text._ZNK5boost15program_options11typed_valueIbcE6xparseERNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EE[_ZNK5boost15program_options11typed_valueIbcE6xparseERNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EE]+0x17): undefined reference to `boost::program_options::validate(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool*, int)'
objlinux/src/Utilities/Options/OptionsParser.o: In function `boost::program_options::error_with_option_name::~error_with_option_name()':
OptionsParser.cpp:(.text._ZN5boost15program_options22error_with_option_nameD2Ev[_ZN5boost15program_options22error_with_option_nameD5Ev]+0x17): undefined reference to `vtable for boost::program_options::error_with_option_name'
objlinux/src/Utilities/Options/OptionsParser.o: In function `boost::program_options::error_with_option_name::error_with_option_name(boost::program_options::error_with_option_name const&)':
OptionsParser.cpp:(.text._ZN5boost15program_options22error_with_option_nameC2ERKS1_[_ZN5boost15program_options22error_with_option_nameC5ERKS1_]+0x22): undefined reference to `vtable for boost::program_options::error_with_option_name'
objlinux/src/Utilities/Options/OptionsParser.o: In function `boost::program_options::basic_command_line_parser<char>::run()':
OptionsParser.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcE3runEv[_ZN5boost15program_options25basic_command_line_parserIcE3runEv]+0x1b): undefined reference to `boost::program_options::detail::cmdline::get_canonical_option_prefix()'
objlinux/src/Utilities/Options/OptionsParser.o: In function `boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*)':
OptionsParser.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcEC2EiPKPKc[_ZN5boost15program_options25basic_command_line_parserIcEC5EiPKPKc]+0x14d): undefined reference to `boost::program_options::to_internal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
OptionsParser.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcEC2EiPKPKc[_ZN5boost15program_options25basic_command_line_parserIcEC5EiPKPKc]+0x1e9): undefined reference to `boost::program_options::detail::cmdline::cmdline(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
objlinux/src/Utilities/Options/OptionsParser.o: In function `boost::program_options::basic_parsed_options<char> boost::program_options::parse_command_line<char>(int, char const* const*, boost::program_options::options_description const&, int, boost::function1<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)':
OptionsParser.cpp:(.text._ZN5boost15program_options18parse_command_lineIcEENS0_20basic_parsed_optionsIT_EEiPKPKS3_RKNS0_19options_descriptionEiNS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESJ_ERKSJ_EE[_ZN5boost15program_options18parse_command_lineIcEENS0_20basic_parsed_optionsIT_EEiPKPKS3_RKNS0_19options_descriptionEiNS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESJ_ERKSJ_EE]+0xaf): undefined reference to `boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)'
objlinux/src/Utilities/Options/OptionsParser.o: In function `_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameB5cxx11Ev':
OptionsParser.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv]+0x32): undefined reference to `_ZN5boost15program_options3argB5cxx11E'
objlinux/src/Utilities/Options/OptionsParser.o: In function `_ZNK5boost15program_options11typed_valueIlcE4nameB5cxx11Ev':
OptionsParser.cpp:(.text._ZNK5boost15program_options11typed_valueIlcE4nameB5cxx11Ev[_ZNK5boost15program_options11typed_valueIlcE4nameB5cxx11Ev]+0x32): undefined reference to `_ZN5boost15program_options3argB5cxx11E'
objlinux/src/Utilities/Options/OptionsParser.o: In function `_ZNK5boost15program_options11typed_valueIbcE4nameB5cxx11Ev':
OptionsParser.cpp:(.text._ZNK5boost15program_options11typed_valueIbcE4nameB5cxx11Ev[_ZNK5boost15program_options11typed_valueIbcE4nameB5cxx11Ev]+0x32): undefined reference to `_ZN5boost15program_options3argB5cxx11E'
objlinux/src/Utilities/Options/OptionsParser.o: In function `_ZNK5boost15program_options11typed_valueIdcE4nameB5cxx11Ev':
OptionsParser.cpp:(.text._ZNK5boost15program_options11typed_valueIdcE4nameB5cxx11Ev[_ZNK5boost15program_options11typed_valueIdcE4nameB5cxx11Ev]+0x32): undefined reference to `_ZN5boost15program_options3argB5cxx11E'
objlinux/src/Utilities/Options/OptionsParser.o: In function `_ZNK5boost15program_options11typed_valueIicE4nameB5cxx11Ev':
OptionsParser.cpp:(.text._ZNK5boost15program_options11typed_valueIicE4nameB5cxx11Ev[_ZNK5boost15program_options11typed_valueIicE4nameB5cxx11Ev]+0x32): undefined reference to `_ZN5boost15program_options3argB5cxx11E'
objlinux/src/Utilities/Options/OptionsParser.o: In function `void boost::program_options::validate<double, char>(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, double*, long)':
OptionsParser.cpp:(.text._ZN5boost15program_options8validateIdcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l[_ZN5boost15program_options8validateIdcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l]+0x4dd): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
objlinux/src/Utilities/Options/OptionsParser.o: In function `void boost::program_options::validate<long, char>(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, long*, long)':
OptionsParser.cpp:(.text._ZN5boost15program_options8validateIlcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l[_ZN5boost15program_options8validateIlcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l]+0x264): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
objlinux/src/Utilities/Options/OptionsParser.o: In function `void boost::program_options::validate<int, char>(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int*, long)':
OptionsParser.cpp:(.text._ZN5boost15program_options8validateIicEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l[_ZN5boost15program_options8validateIicEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l]+0x233): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE]+0x20): undefined reference to `boost::program_options::error_with_option_name::what() const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE]+0x28): undefined reference to `boost::program_options::error_with_option_name::what() const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE]+0x20): undefined reference to `boost::program_options::error_with_option_name::what() const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE]+0x28): undefined reference to `boost::program_options::error_with_option_name::what() const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTIN5boost15program_options16validation_errorE[_ZTIN5boost15program_options16validation_errorE]+0x10): undefined reference to `typeinfo for boost::program_options::error_with_option_name'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost15program_options16validation_errorE[_ZTVN5boost15program_options16validation_errorE]+0x20): undefined reference to `boost::program_options::error_with_option_name::what() const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost15program_options16validation_errorE[_ZTVN5boost15program_options16validation_errorE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost15program_options20invalid_option_valueE[_ZTVN5boost15program_options20invalid_option_valueE]+0x20): undefined reference to `boost::program_options::error_with_option_name::what() const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost15program_options20invalid_option_valueE[_ZTVN5boost15program_options20invalid_option_valueE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEE[_ZTVN5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost15program_options11typed_valueIicEE[_ZTVN5boost15program_options11typed_valueIicEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost15program_options11typed_valueIlcEE[_ZTVN5boost15program_options11typed_valueIlcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost15program_options11typed_valueIdcEE[_ZTVN5boost15program_options11typed_valueIdcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
objlinux/src/Utilities/Options/OptionsParser.o:(.rodata._ZTVN5boost15program_options11typed_valueIbcEE[_ZTVN5boost15program_options11typed_valueIbcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
collect2: error: ld returned 1 exit status
make: *** [ACOPPD] Error 1
I tried different techniques to resolve this error:
I tried to just do the recommended include : #include "boost/program_options.hpp" and -I /home/mkupper/boost/boost_1_66_0 in the Makefile as it is recommended by the boost documentation for header-only library, which program_options is.
I tried to include with the full path : #include "/home/mkupper/boost/boost_1_66_0/boost/program_options.hpp"
I tried to include -I /home/mkupper/boost/boost_1_66_0 -L /home/mkupper/boost/boost_1_66_0/libs into the linker and compiler flags to.
I tried to include -lboost_program_options in addition to the other includes.
I tried if the -lstdc++ would change anything.
Nothing changes the linker errors, I am helpless !
Here my current Makefile:
CFLAGS := -std=c++14 -Wall -Ofast -march=native -Wunused-parameter
LDFLAGS := -lstdc++ -I /home/mkupper/boost/boost_1_66_0 -L /home/mkupper/boost/boost_1_66_0/libs
BUILDDIR := objlinux
SOURCEDIR := src
HEADERDIR := include
SRCEXT := cpp
OBJEXT := o
SOURCES := $(shell find $(SOURCEDIR) -name '*.$(SRCEXT)')
OBJECTS := $(addprefix $(BUILDDIR)/,$(SOURCES:%.$(SRCEXT)=%.$(OBJEXT)))
BINARY := ./ACOPPD
ECHO := echo
RM := rm -rf
MKDIR := mkdir
.PHONY: all clean
all: $(BINARY)
$(BINARY): $(OBJECTS)
g++_71 $(CFLAGS) $(OBJECTS) -o $(BINARY) $(LDFLAGS)
$(BUILDDIR)/%.$(OBJEXT): %.$(SRCEXT)
g++_71 $(CFLAGS) $(LDFLAGS) -I $(HEADERDIR) -I $(dir $<) -c $< -o $#
clean:
$(RM) $(BINARY) $(OBJECTS)
distclean: clean
The -I option indicates where the compiler needs to find the include files, therefore it belongs to the compiler flags CFLAGS.
The -L option indicates where the linker needs to find the library files, and the -l option tells the linker which libraries to include, therefore both should go into LDFLAGS.
With these said, you have missed the -lboost_program_options flag in LDFLAGS. As a result the linker will not incorporate the boost_program_options library. -L alone here is meaningless.
Bottom lines - try these:
CFLAGS := -std=c++14 -Wall -Ofast -march=native -Wunused-parameter -I/home/mkupper/boost/boost_1_66_0
LDFLAGS := -L/home/mkupper/boost/boost_1_66_0/libs -lstdc++ -lboost_program_options
This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 5 years ago.
I am trying to use program_options from Boost in my project.
I am using Windows 10 but compiling on the ubuntu subsystem using g++.
I installed on boost using sudo apt install libboost-all-dev and then proceeded to try out their example file found here.
Then I compiled using g++ first.cpp and received the following error:
/tmp/cc9iLK5U.o: In function `main':
first.cpp:(.text+0x2e): undefined reference to `boost::program_options::options_description::m_default_line_length'
first.cpp:(.text+0x3a): undefined reference to `boost::program_options::options_description::m_default_line_length'
first.cpp:(.text+0x80): undefined reference to `boost::program_options::options_description::options_description(std::__cxx11::basic_string<char, std::char_traits<char>, std::allo
cator<char> > const&, unsigned int, unsigned int)'
first.cpp:(.text+0xb5): undefined reference to `boost::program_options::options_description::add_options()'
first.cpp:(.text+0xd5): undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, char const*)'
first.cpp:(.text+0xea): undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char
const*)'
first.cpp:(.text+0xf9): undefined reference to `boost::program_options::variables_map::variables_map()'
first.cpp:(.text+0x159): undefined reference to `boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, b
ool)'
first.cpp:(.text+0x186): undefined reference to `boost::program_options::notify(boost::program_options::variables_map&)'
first.cpp:(.text+0x20b): undefined reference to `boost::program_options::operator<<(std::ostream&, boost::program_options::options_description const&)'
/tmp/cc9iLK5U.o: In function `boost::program_options::error_with_option_name::~error_with_option_name()':
first.cpp:(.text._ZN5boost15program_options22error_with_option_nameD2Ev[_ZN5boost15program_options22error_with_option_nameD5Ev]+0x10): undefined reference to `vtable for boost::pr
ogram_options::error_with_option_name'
/tmp/cc9iLK5U.o: In function `boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::__cxx11::basic_string<char, std::ch
ar_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
first.cpp:(.text._ZN5boost15program_options16validation_errorC2ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i[_ZN5boost15program_options16validation_error
C5ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i]+0x3d): undefined reference to `boost::program_options::validation_error::get_template[abi:cxx11](boost::
program_options::validation_error::kind_t)'
first.cpp:(.text._ZN5boost15program_options16validation_errorC2ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i[_ZN5boost15program_options16validation_error
C5ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i]+0x5b): undefined reference to `boost::program_options::error_with_option_name::error_with_option_name(st
d::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::
__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/tmp/cc9iLK5U.o: In function `boost::program_options::value_semantic_codecvt_helper<char>::value_semantic_codecvt_helper()':
first.cpp:(.text._ZN5boost15program_options29value_semantic_codecvt_helperIcEC2Ev[_ZN5boost15program_options29value_semantic_codecvt_helperIcEC5Ev]+0x19): undefined reference to `
vtable for boost::program_options::value_semantic_codecvt_helper<char>'
/tmp/cc9iLK5U.o: In function `boost::program_options::value_semantic_codecvt_helper<char>::~value_semantic_codecvt_helper()':
first.cpp:(.text._ZN5boost15program_options29value_semantic_codecvt_helperIcED2Ev[_ZN5boost15program_options29value_semantic_codecvt_helperIcED5Ev]+0xd): undefined reference to `v
table for boost::program_options::value_semantic_codecvt_helper<char>'
/tmp/cc9iLK5U.o: In function `boost::program_options::variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
first.cpp:(.text._ZNK5boost15program_options13variables_mapixERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK5boost15program_options13variables_mapixERKNSt7__cxx1112ba
sic_stringIcSt11char_traitsIcESaIcEEE]+0x1f): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<
char>, std::allocator<char> > const&) const'
/tmp/cc9iLK5U.o: In function `boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*)':
first.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcEC2EiPKPKc[_ZN5boost15program_options25basic_command_line_parserIcEC5EiPKPKc]+0x81): undefined reference to
`boost::program_options::detail::cmdline::cmdline(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_
string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
/tmp/cc9iLK5U.o: In function `boost::program_options::basic_command_line_parser<char>::options(boost::program_options::options_description const&)':
first.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcE7optionsERKNS0_19options_descriptionE[_ZN5boost15program_options25basic_command_line_parserIcE7optionsERKN
S0_19options_descriptionE]+0x1f): undefined reference to `boost::program_options::detail::cmdline::set_options_description(boost::program_options::options_description const&)'
/tmp/cc9iLK5U.o: In function `boost::program_options::basic_command_line_parser<char>::style(int)':
first.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcE5styleEi[_ZN5boost15program_options25basic_command_line_parserIcE5styleEi]+0x1c): undefined reference to `
boost::program_options::detail::cmdline::style(int)'
/tmp/cc9iLK5U.o: In function `boost::program_options::basic_command_line_parser<char>::extra_parser(boost::function1<std::pair<std::__cxx11::basic_string<char, std::char_traits<ch
ar>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::alloc
ator<char> > const&>)':
first.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcE12extra_parserENS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_ERKSA_EE[_ZN5b
oost15program_options25basic_command_line_parserIcE12extra_parserENS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_ERKSA_EE]+0x42): undefined reference
to `boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std
::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)'
/tmp/cc9iLK5U.o: In function `boost::program_options::basic_command_line_parser<char>::run()':
first.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcE3runEv[_ZN5boost15program_options25basic_command_line_parserIcE3runEv]+0x28): undefined reference to `boos
t::program_options::detail::cmdline::get_canonical_option_prefix()'
first.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcE3runEv[_ZN5boost15program_options25basic_command_line_parserIcE3runEv]+0x54): undefined reference to `boos
t::program_options::detail::cmdline::run()'
/tmp/cc9iLK5U.o: In function `std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::cha
r_traits<char>, std::allocator<char> > > > boost::program_options::to_internal<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::vector<std::_
_cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const
&)':
first.cpp:(.text._ZN5boost15program_options11to_internalINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESt6vectorIS7_SaIS7_EERKS8_IT_SaISB_EE[_ZN5boost15program_options11to
_internalINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESt6vectorIS7_SaIS7_EERKS8_IT_SaISB_EE]+0x6c): undefined reference to `boost::program_options::to_internal(std::__cx
x11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost15program_options11typed_valueIdcEE[_ZTVN5boost15program_options11typed_valueIdcEE]+0x38): undefined reference to `boost::program_options::valu
e_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic
_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost15program_options20invalid_option_valueE[_ZTVN5boost15program_options20invalid_option_valueE]+0x20): undefined reference to `boost::program_opt
ions::error_with_option_name::what() const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost15program_options20invalid_option_valueE[_ZTVN5boost15program_options20invalid_option_valueE]+0x30): undefined reference to `boost::program_opt
ions::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost15program_options16validation_errorE[_ZTVN5boost15program_options16validation_errorE]+0x20): undefined reference to `boost::program_options::er
ror_with_option_name::what() const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost15program_options16validation_errorE[_ZTVN5boost15program_options16validation_errorE]+0x30): undefined reference to `boost::program_options::er
ror_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/tmp/cc9iLK5U.o:(.rodata._ZTIN5boost15program_options11typed_valueIdcEE[_ZTIN5boost15program_options11typed_valueIdcEE]+0x18): undefined reference to `typeinfo for boost::program_
options::value_semantic_codecvt_helper<char>'
/tmp/cc9iLK5U.o:(.rodata._ZTIN5boost15program_options16validation_errorE[_ZTIN5boost15program_options16validation_errorE]+0x10): undefined reference to `typeinfo for boost::progra
m_options::error_with_option_name'
/tmp/cc9iLK5U.o: In function `boost::program_options::variables_map::~variables_map()':
first.cpp:(.text._ZN5boost15program_options13variables_mapD2Ev[_ZN5boost15program_options13variables_mapD5Ev]+0xe): undefined reference to `vtable for boost::program_options::vari
ables_map'
/tmp/cc9iLK5U.o: In function `boost::program_options::typed_value<double, char>::name() const':
first.cpp:(.text._ZNK5boost15program_options11typed_valueIdcE4nameEv[_ZNK5boost15program_options11typed_valueIdcE4nameEv]+0x41): undefined reference to `boost::program_options::ar
g[abi:cxx11]'
/tmp/cc9iLK5U.o: In function `void boost::program_options::validate<double, char>(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<
char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, double*, long)':
first.cpp:(.text._ZN5boost15program_options8validateIdcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l[_ZN5boost15program_options8va
lidateIdcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l]+0x44): undefined reference to `boost::program_options::validators::check_f
irst_occurrence(boost::any const&)'
first.cpp:(.text._ZN5boost15program_options8validateIdcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l[_ZN5boost15program_options8va
lidateIdcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l]+0x141): undefined reference to `boost::program_options::invalid_option_val
ue::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/cc9iLK5U.o: In function `boost::program_options::error_with_option_name::error_with_option_name(boost::program_options::error_with_option_name const&)':
first.cpp:(.text._ZN5boost15program_options22error_with_option_nameC2ERKS1_[_ZN5boost15program_options22error_with_option_nameC5ERKS1_]+0x25): undefined reference to `vtable for b
oost::program_options::error_with_option_name'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE[_ZTVN5boost16exception_detail10clone_implI
NS0_19error_info_injectorINS_15program_options16validation_errorEEEEE]+0x28): undefined reference to `boost::program_options::error_with_option_name::what() const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE[_ZTVN5boost16exception_detail10clone_implI
NS0_19error_info_injectorINS_15program_options16validation_errorEEEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::
__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15progr
am_options16validation_errorEEE]+0x20): undefined reference to `boost::program_options::error_with_option_name::what() const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15progr
am_options16validation_errorEEE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_
traits<char>, std::allocator<char> > const&) const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE[_ZTVN5boost16exception_detail10clone_i
mplINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE]+0x28): undefined reference to `boost::program_options::error_with_option_name::what() const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE[_ZTVN5boost16exception_detail10clone_i
mplINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholde
rs(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15p
rogram_options20invalid_option_valueEEE]+0x20): undefined reference to `boost::program_options::error_with_option_name::what() const'
/tmp/cc9iLK5U.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15p
rogram_options20invalid_option_valueEEE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, st
d::char_traits<char>, std::allocator<char> > const&) const'
collect2: error: ld returned 1 exit status
I am not sure if I missed a step or is it something related to WSL it self.
Turns out the problem is not related to WSL. I just had to add the appropriate links:
c++ first.cpp -lboost_program_options
I have been smashing my head on my keyboard on this for hours and on similar problems for the last 3 days. I am new to cmake and trying to figure it out.
Basically i have a very simple program example for a library i am trying to use, and i am trying to make a cmake file to compile it and include all of its dependancies properly. It is day 3 and i am getting this linker error now though and i can't for the life of me figure out why.
This is what i have in my CMakeLists.txt:
cmake_minimum_required(VERSION 3.4)
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
message( FATAL_ERROR "In-source builds not allowed. Please make a new directory and run CMake from there. You may need to remove CMakeCache.txt." )
endif()
set(PROJECT_NAME HelloWorldDiscordBot)
project(${PROJECT_NAME})
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/bin
CACHE PATH
"Single Directory for all"
)
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/bin
CACHE PATH
"Single Directory for all"
)
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/lib
CACHE PATH
"Single Directory for all"
)
include_directories("/home/connor/Documents/yourWaifu-sleepy-discord/")
include_directories("/home/connor/projects/HelloWorldDiscordBot/deps/")
include_directories("/home/connor/projects/HelloWorldDiscordBot/deps/include/")
include_directories("/home/connor/projects/HelloWorldDiscordBot/deps/cpr/cpr/")
include_directories("/usr/local/openssl/include")
#include_directories("/usr/include")
#include_directories("/home/connor/Documents/yourWaifu-sleepy-discord/sleepy_discord/IncludeNonexistent/")
#include_directories("/home/connor/Documents/yourWaifu-sleepy-discord/sleepy_discord/IncludeNonexistent/websocketpp/config/")
#include_directories("/home/connor/projects/HelloWorldDiscordBot/deps/lib/")
set(HelloWorldDiscordBot_sources main.cpp)
add_executable(${PROJECT_NAME} ${HelloWorldDiscordBot_sources})
target_link_libraries(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/deps/lib/libssl.a
${PROJECT_SOURCE_DIR}/deps/lib/libcrypto.a
${PROJECT_SOURCE_DIR}/deps/lib/libsleepy_discord.a)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
The linker error's i'm getting:
/home/connor/projects/HelloWorldDiscordBot/build> make -j2
-- Configuring done
-- Generating done
-- Build files have been written to: /home/connor/projects/HelloWorldDiscordBot/build
[ 50%] Linking CXX executable bin/HelloWorldDiscordBot
../deps/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x11): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x2f): undefined reference to `dlclose'
../deps/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x334): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x3db): undefined reference to `dlerror'
../deps/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x454): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x4fb): undefined reference to `dlerror'
../deps/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x569): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x5cb): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x603): undefined reference to `dlerror'
../deps/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
dso_dlfcn.c:(.text+0x69f): undefined reference to `dladdr'
dso_dlfcn.c:(.text+0x709): undefined reference to `dlerror'
../deps/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x762): undefined reference to `dlclose'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o: In function `main':
/home/connor/projects/HelloWorldDiscordBot/main.cpp:17: undefined reference to `SleepyDiscord::WebsocketppDiscordClient::run()'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o: In function `myClientClass::myClientClass(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char)':
/home/connor/projects/HelloWorldDiscordBot/main.cpp:8: undefined reference to `SleepyDiscord::WebsocketppDiscordClient::WebsocketppDiscordClient(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char)'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o: In function `myClientClass::~myClientClass()':
/home/connor/projects/HelloWorldDiscordBot/main.cpp:6: undefined reference to `SleepyDiscord::WebsocketppDiscordClient::~WebsocketppDiscordClient()'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o:(.rodata._ZTV13myClientClass[_ZTV13myClientClass]+0x10): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::run()'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o:(.rodata._ZTV13myClientClass[_ZTV13myClientClass]+0x1a0): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::sleep(unsigned int)'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o:(.rodata._ZTV13myClientClass[_ZTV13myClientClass]+0x1b8): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::onError(SleepyDiscord::ErrorCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o:(.rodata._ZTV13myClientClass[_ZTV13myClientClass]+0x1c0): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o:(.rodata._ZTV13myClientClass[_ZTV13myClientClass]+0x1c8): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::send(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o:(.rodata._ZTV13myClientClass[_ZTV13myClientClass]+0x1d0): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::disconnect(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o:(.rodata._ZTV13myClientClass[_ZTV13myClientClass]+0x1d8): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::runAsync()'
CMakeFiles/HelloWorldDiscordBot.dir/main.cpp.o:(.rodata._ZTI13myClientClass[_ZTI13myClientClass]+0x10): undefined reference to `typeinfo for SleepyDiscord::WebsocketppDiscordClient'
../deps/lib/libsleepy_discord.a(client.cpp.o): In function `SleepyDiscord::CPRSession::setUrl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
client.cpp:(.text._ZN13SleepyDiscord10CPRSession6setUrlERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN13SleepyDiscord10CPRSession6setUrlERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x46): undefined reference to `cpr::Session::SetUrl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
../deps/lib/libsleepy_discord.a(client.cpp.o): In function `SleepyDiscord::CPRSession::setBody(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*)':
client.cpp:(.text._ZN13SleepyDiscord10CPRSession7setBodyEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN13SleepyDiscord10CPRSession7setBodyEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x46): undefined reference to `cpr::Session::SetBody(cpr::Body&&)'
../deps/lib/libsleepy_discord.a(client.cpp.o): In function `SleepyDiscord::CPRSession::Post()':
client.cpp:(.text._ZN13SleepyDiscord10CPRSession4PostEv[_ZN13SleepyDiscord10CPRSession4PostEv]+0x42): undefined reference to `cpr::Session::Post()'
../deps/lib/libsleepy_discord.a(client.cpp.o): In function `SleepyDiscord::CPRSession::Patch()':
client.cpp:(.text._ZN13SleepyDiscord10CPRSession5PatchEv[_ZN13SleepyDiscord10CPRSession5PatchEv]+0x42): undefined reference to `cpr::Session::Patch()'
../deps/lib/libsleepy_discord.a(client.cpp.o): In function `SleepyDiscord::CPRSession::Delete()':
client.cpp:(.text._ZN13SleepyDiscord10CPRSession6DeleteEv[_ZN13SleepyDiscord10CPRSession6DeleteEv]+0x42): undefined reference to `cpr::Session::Delete()'
../deps/lib/libsleepy_discord.a(client.cpp.o): In function `SleepyDiscord::CPRSession::Get()':
client.cpp:(.text._ZN13SleepyDiscord10CPRSession3GetEv[_ZN13SleepyDiscord10CPRSession3GetEv]+0x42): undefined reference to `cpr::Session::Get()'
../deps/lib/libsleepy_discord.a(client.cpp.o): In function `SleepyDiscord::CPRSession::Put()':
client.cpp:(.text._ZN13SleepyDiscord10CPRSession3PutEv[_ZN13SleepyDiscord10CPRSession3PutEv]+0x42): undefined reference to `cpr::Session::Put()'
../deps/lib/libsleepy_discord.a(client.cpp.o): In function `SleepyDiscord::CPRSession::CPRSession()':
client.cpp:(.text._ZN13SleepyDiscord10CPRSessionC2Ev[_ZN13SleepyDiscord10CPRSessionC5Ev]+0x30): undefined reference to `cpr::Session::Session()'
../deps/lib/libsleepy_discord.a(client.cpp.o): In function `SleepyDiscord::CPRSession::~CPRSession()':
client.cpp:(.text._ZN13SleepyDiscord10CPRSessionD2Ev[_ZN13SleepyDiscord10CPRSessionD5Ev]+0x24): undefined reference to `cpr::Session::~Session()'
../deps/lib/libsleepy_discord.a(client.cpp.o): In function `std::thread::thread<void (SleepyDiscord::BaseDiscordClient::*)(), SleepyDiscord::BaseDiscordClient*>(void (SleepyDiscord::BaseDiscordClient::*&&)(), SleepyDiscord::BaseDiscordClient*&&)':
client.cpp:(.text._ZNSt6threadC2IMN13SleepyDiscord17BaseDiscordClientEFvvEJPS2_EEEOT_DpOT0_[_ZNSt6threadC5IMN13SleepyDiscord17BaseDiscordClientEFvvEJPS2_EEEOT_DpOT0_]+0x93): undefined reference to `pthread_create'
../deps/lib/libsleepy_discord.a(cpr_session.cpp.o): In function `SleepyDiscord::CPRSession::setHeader(std::initializer_list<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
cpr_session.cpp:(.text+0xdd): undefined reference to `cpr::Session::SetHeader(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, cpr::CaseInsensitiveCompare, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
../deps/lib/libsleepy_discord.a(cpr_session.cpp.o): In function `SleepyDiscord::CPRSession::setMultipart(std::initializer_list<SleepyDiscord::Part> const&)':
cpr_session.cpp:(.text+0x346): undefined reference to `cpr::Multipart::Multipart(std::initializer_list<cpr::Part> const&)'
cpr_session.cpp:(.text+0x39d): undefined reference to `cpr::Session::SetMultipart(cpr::Multipart const&)'
../deps/lib/libsleepy_discord.a(cpr_session.cpp.o): In function `std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, cpr::CaseInsensitiveCompare, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
cpr_session.cpp:(.text._ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE24_M_get_insert_unique_posERS7_[_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE24_M_get_insert_unique_posERS7_]+0x72): undefined reference to `cpr::CaseInsensitiveCompare::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
cpr_session.cpp:(.text._ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE24_M_get_insert_unique_posERS7_[_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE24_M_get_insert_unique_posERS7_]+0x12a): undefined reference to `cpr::CaseInsensitiveCompare::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
../deps/lib/libsleepy_discord.a(cpr_session.cpp.o): In function `std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, cpr::CaseInsensitiveCompare, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_insert_<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >&, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, cpr::CaseInsensitiveCompare, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_Alloc_node>(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >&, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, cpr::CaseInsensitiveCompare, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_Alloc_node&)':
cpr_session.cpp:(.text._ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE10_M_insert_IRS6_IS5_S5_ENSE_11_Alloc_nodeEEESt17_Rb_tree_iteratorIS8_EPSt18_Rb_tree_node_baseSM_OT_RT0_[_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE10_M_insert_IRS6_IS5_S5_ENSE_11_Alloc_nodeEEESt17_Rb_tree_iteratorIS8_EPSt18_Rb_tree_node_baseSM_OT_RT0_]+0x84): undefined reference to `cpr::CaseInsensitiveCompare::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
collect2: error: ld returned 1 exit status
CMakeFiles/HelloWorldDiscordBot.dir/build.make:97: recipe for target 'bin/HelloWorldDiscordBot' failed
make[2]: *** [bin/HelloWorldDiscordBot] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/HelloWorldDiscordBot.dir/all' failed
make[1]: *** [CMakeFiles/HelloWorldDiscordBot.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
*** Failure: Exit code 2 ***
The structure of my project dependencies folder
Am i doing something wrong? I am pretty sure i have all of my dependencies in check, so i am wondering if i maybe did something dumb in my cmake file.