opencv in centos 6.5 - c++

I have installed opencv recently . I am trying to do a bit if image processing using opencv and cuda. but I am getting an error like this
nvcc -o reference_hw1 reference_main.o student_func.o compare.o reference_calc.o -arch=sm_20 -Xcompiler -Wall -Xcompiler -Wextra -m64 -L /usr/lib
reference_main.o: In function `preProcess(uchar4**, unsigned char**, uchar4**, unsigned char**, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
reference_main.cpp:(.text+0xc4): undefined reference to `cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
reference_main.cpp:(.text+0x1b7): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
reference_main.cpp:(.text+0x1cd): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
reference_main.cpp:(.text+0x1ea): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
reference_main.o: In function `postProcess(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*)':
reference_main.cpp:(.text+0x45a): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
reference_main.cpp:(.text+0x4a2): undefined reference to `cv::imwrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
reference_main.o: In function `generateReferenceImage(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
reference_main.cpp:(.text+0x5b2): undefined reference to `cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
reference_main.cpp:(.text+0x5d4): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
reference_main.cpp:(.text+0x5ee): undefined reference to `cv::imwrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
reference_main.o: In function `cv::Mat::~Mat()':
reference_main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
reference_main.o: In function `cv::Mat::operator=(cv::Mat const&)':
reference_main.cpp:(.text._ZN2cv3MataSERKS0_[cv::Mat::operator=(cv::Mat const&)]+0x111): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
reference_main.o: In function `cv::Mat::create(int, int, int)':
reference_main.cpp:(.text._ZN2cv3Mat6createEiii[cv::Mat::create(int, int, int)]+0x96): undefined reference to `cv::Mat::create(int, int const*, int)'
reference_main.o: In function `cv::Mat::release()':
reference_main.cpp:(.text._ZN2cv3Mat7releaseEv[cv::Mat::release()]+0x47): undefined reference to `cv::Mat::deallocate()'
compare.o: In function `compareImages(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, double, double)':
compare.cpp:(.text+0x4e): undefined reference to `cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
compare.cpp:(.text+0x6c): undefined reference to `cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
compare.cpp:(.text+0x8c): undefined reference to `cv::operator-(cv::Mat const&, cv::Mat const&)'
compare.cpp:(.text+0xa5): undefined reference to `cv::abs(cv::MatExpr const&)'
compare.cpp:(.text+0x15a): undefined reference to `cv::Mat::reshape(int, int) const'
compare.cpp:(.text+0x15f): undefined reference to `cv::noArray()'
compare.cpp:(.text+0x17b): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
compare.cpp:(.text+0x1a9): undefined reference to `cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&)'
compare.cpp:(.text+0x20c): undefined reference to `cv::operator-(cv::Mat const&, cv::Scalar_<double> const&)'
compare.cpp:(.text+0x22d): undefined reference to `cv::operator*(cv::MatExpr const&, double)'
compare.cpp:(.text+0x2d2): undefined reference to `cv::Mat::reshape(int, int) const'
compare.cpp:(.text+0x33d): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
compare.cpp:(.text+0x375): undefined reference to `cv::imwrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
collect2: ld returned 1 exit status
make: *** [student] Error 1
I don't know why the error is like this. My Makefile is
NVCC= nvcc
###################################
# These are the default install #
# locations on most linux distros #
###################################
OPENCV_LIBPATH=/usr/lib
OPENCV_INCLUDEPATH=/usr/local/include
OPENCV_TROUBLE=
CUDA_INCLUDEPATH=/usr/local/cuda/include
NVCC_OPTS = -arch=sm_20 -Xcompiler -Wall -Xcompiler -Wextra -m64
GCC_OPTS = -Wall -Wextra -m64
student: reference_main.o student_func.o compare.o reference_calc.o Makefile
$(NVCC) -o reference_hw1 reference_main.o student_func.o compare.o reference_calc.o $(NVCC_OPTS) -L $(OPENCV_LIBPATH) $(OPENCV_TROUBLE)
reference_main.o: reference_main.cpp timer.h utils.h reference_calc.cpp compare.cpp reference_hw1.cpp
g++ -c reference_main.cpp $(GCC_OPTS) -I $(OPENCV_INCLUDEPATH) -I $(CUDA_INCLUDEPATH) $(OPENCV_LIBPATH) $(OPENCV_TROUBLE)
student_func.o: student_func.cu utils.h
nvcc -c student_func.cu $(NVCC_OPTS)
compare.o: compare.cpp compare.h
g++ -c compare.cpp -I $(CUDA_INCLUDEPATH) $(GCC_OPTS) -I $(OPENCV_INCLUDEPATH) $(OPENCV_LIBPATH) $(OPENCV_TROUBLE)
reference_calc.o: reference_calc.cpp reference_calc.h
g++ -c reference_calc.cpp -I $(CUDA_INCLUDEPATH) $(GCC_OPTS) -I $(OPENCV_INCLUDEPATH) $(OPENCV_LIBPATH) $(OPENCV_TROUBLE)
clean:
rm -f *.o *.png hw
In the directory of /usr/local/include
there are two folders opencv and opencv2 , so everything is fine according to the arrangements .
Now how to solve the problem ?
yesterday whole day got used in solution for this problem.
Please anybody help me.. Thanks in advance...
I tried all the methods.....

Related

trying to compile static libmysqlcppconn8-static.a on Ubuntu 18.04.6 LTS

After looking ant trying all links on the web i just can't figure what is wrong.
g++ version :
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
This is my compilation line :
/usr/bin/g++ -fdiagnostics-color=always -Wall -std=c++11 -DSTATIC_CONCPP -I/home/vagrant/cpp/mysql-connector-cpp/include/ -I/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/ -I/home/vagrant/cpp/mysql-connector-cpp/common/ -I/home/vagrant/cpp/boost/ -I/home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf -g /home/vagrant/cpp/mysql_conn_app/main.cpp /home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a -lssl -lcrypto -lpthread -lresolv -o /home/vagrant/cpp/mysql_conn_app/main.exe
This is the error:
/tmp/ccUnnhKN.o: In function `mysqlx::abi2::r0::string::traits<char>::from_str(mysqlx::abi2::r0::string&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/devapi/common.h:220: undefined reference to `mysqlx::abi2::r0::string::Impl::from_utf8(mysqlx::abi2::r0::string&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccUnnhKN.o: In function `mysqlx::abi2::r0::string::traits<char>::to_str[abi:cxx11](mysqlx::abi2::r0::string const&)':
/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/devapi/common.h:225: undefined reference to `mysqlx::abi2::r0::string::Impl::to_utf8[abi:cxx11](mysqlx::abi2::r0::string const&)'
/tmp/ccUnnhKN.o: In function `mysqlx::abi2::r0::SessionSettings::SessionSettings(mysqlx::abi2::r0::string const&)':
/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/devapi/settings.h:526: undefined reference to `mysqlx::abi2::r0::common::Settings_impl::set_from_uri(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::log_handler_init()':
./build/cdk/protocol/mysqlx/./cdk/protocol/mysqlx/protocol.cc:131: undefined reference to `google::protobuf::SetLogHandler(void (*)(google::protobuf::LogLevel, char const*, int, std::string const&))'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Ok(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:947: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Error(unsigned short, cdk::foundation::string
....
what is wrong here ?
also when adding "-D_GLIBCXX_USE_CXX11_ABI=0" as suggested here:
still not working
/usr/bin/g++ -fdiagnostics-color=always -Wall -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -DSTATIC_CONCPP -I/home/vagrant/cpp/mysql-connector-cpp/include/ -I/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/ -I/home/vagrant/cpp/mysql-connector-cpp/common/ -I/home/vagrant/cpp/boost/ -I/home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf -g /home/vagrant/cpp/mysql_conn_app/main.cpp /home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a -lssl -lcrypto -lpthread -lresolv -o /home/vagrant/cpp/mysql_conn_app/main.exe
gives :
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::log_handler_init()':
./build/cdk/protocol/mysqlx/./cdk/protocol/mysqlx/protocol.cc:131: undefined reference to `google::protobuf::SetLogHandler(void (*)(google::protobuf::LogLevel, char const*, int, std::string const&))'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Ok(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:947: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Error(unsigned short, cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:1146: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Expr_builder_base::set_call(cdk::protocol::mysqlx::api::Db_obj const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2562: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
adding protobuf + -D_GLIBCXX_USE_CXX11_ABI=0 same error:
/usr/bin/g++ -fdiagnostics-color=always -Wall -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -DSTATIC_CONCPP -I/home/vagrant/cpp/mysql-connector-cpp/include/ -I/home/vagrant/cpp/mysql-connector-cpp/include/mysqlx/ -I/home/vagrant/cpp/mysql-connector-cpp/common/ -I/home/vagrant/cpp/boost/ -I/home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf -g /home/vagrant/cpp/mysql_conn_app/main.cpp /home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a /home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf/protobuf-3.19.4/cmake/libprotobufd.a /home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf/protobuf-3.19.4/cmake/libprotobuf-lited.a /home/vagrant/cpp/mysql-connector-cpp/build/cdk/protocol/mysqlx/protobuf/protobuf-3.19.4/cmake/libprotocd.a -lssl -lcrypto -lpthread -lresolv -o /home/vagrant/cpp/mysql_conn_app/main.exe
gives :
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::log_handler_init()':
./build/cdk/protocol/mysqlx/./cdk/protocol/mysqlx/protocol.cc:131: undefined reference to `google::protobuf::SetLogHandler(void (*)(google::protobuf::LogLevel, char const*, int, std::string const&))'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Ok(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:947: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Protocol_server::snd_Error(unsigned short, cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx.pb.h:1146: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Expr_builder_base::set_call(cdk::protocol::mysqlx::api::Db_obj const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2562: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2631: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `cdk::protocol::mysqlx::Expr_builder_base::var(cdk::foundation::string const&)':
./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2013: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)'
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o):./build/cdk/protocol/mysqlx/./build/cdk/protocol/mysqlx/protobuf/mysqlx_expr.pb.h:2874: more undefined references to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string&&, google::protobuf::Arena*)' follow
/home/vagrant/cpp/mysql-connector-cpp/build/libmysqlcppconn8-static.a(libcdk_proto_mysqlx_protocol.cc.o): In function `void google::protobuf::internal::ArenaStringPtr::Set<google::protobuf::internal::ArenaStringPtr::EmptyDefault>(google::protobuf::internal::ArenaStringPtr::EmptyDefault, char const*, google::protobuf::Arena*)':
./build/cdk/protocol/mysqlx/./cdk/extra/protobuf/protobuf-3.19.4/src/google/protobuf/arenastring.h:200: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::string const&, google::protobuf::Arena*)'

program option linking error boost library with 1.66 version

I am working on one project where I need to compile all our backend c++ applications from centos to rhel8 Linux machine. I am facing a boost program option error with the boost 1.66 version which comes preloaded in rhel8. If I use boost 1.63 it works for me but mt library. mt library is not available in boost 1.66 version. So i made few changes in makefile. Please find below the difference of make file between 1.63 and 1.66 boost. I am getting program option linking error . Please help me to solve this issue.
working command-line compilation with boost 1.63.
/usr/bin/g++ -o /home/rhel8/allan/dev/kevlar/bin/linux5_64_DBG/toolset -g -export-dynamic -Wl,"-(" /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarToolSet.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarToolSetMain.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarJournalEditorTool.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarQueryCheckpointTool.o /home/rhel8/allan/dev/cure/lib/linux5_64_DBG/libcureapplication.a /home/rhel8/allan/dev/eqmon/lib/linux5_64_DBG/libeqmon-mt.a /home/rhel8/allan/dev/eqcyclopsmon/lib/linux5_64_DBG/libeqcyclopsmon.a /home/rhel8/allan/dev/ivcom/src/linux5_64_DBG/libivcom.a /home/rhel8/allan/dev/gslog/lib/linux5_64_DBG/libgslog-mt.a /home/rhel8/allan/dev/gscpputil/linux5_64_DBG/libgscpputil.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcre.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcrecpp.a /home/rhel8/allan/dev/gscushmdb/linux5_64_DBG/libgscushmdb.a /home/rhel8/allan/dev/hermes/lib/linux5_64_DBG/libhermescommandmanager.a /home/rhel8/allan/dev/hermes/lib/linux5_64_DBG/libhermescommon.a /home/rhel8/allan/dev/ivshmdb/api/linux5_64_DBG/libivshmdbapi.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libIvShmDbUserEnums.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libivshmdbcommanddefinition.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libIvShmDbUserRecords.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarapplication.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcurrenttime.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcommandlinetools.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlardatastreampair.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarflightrecorder.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarjournalmanager.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarmessagewrapper.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarreplicator.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarresources.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarsharedmemoryutils.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlartransaction.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlaruniqueid.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libKevlarUserEnums.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcommanddefinition.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libKevlarUserRecords.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libUserRecords.a -Wl,"-)" /home/rhel8/allan/boost_1.63/lib/libboost_filesystem-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_regex-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_program_options-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_date_time-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_system-mt.a -lexpat /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcre.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcrecpp.a /usr/lib64/libpython2.7.so -pthread -Xlinker -ldl -ltirpc -lutil -lrt
/home/rhel8/allan/boost_1.63/lib/libboost_filesystem-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_regex-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_program_options-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_date_time-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_system-mt.a
non working command line compilation with boost 1.66
/usr/bin/g++ -o /home/rhel8/allan/dev/kevlar/bin/linux5_64_DBG/toolset -g -export-dynamic -Wl,"-(" /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarToolSet.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarToolSetMain.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarJournalEditorTool.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarQueryCheckpointTool.o /home/rhel8/allan/dev/cure/lib/linux5_64_DBG/libcureapplication.a /home/rhel8/allan/dev/eqmon/lib/linux5_64_DBG/libeqmon-mt.a /home/rhel8/allan/dev/eqcyclopsmon/lib/linux5_64_DBG/libeqcyclopsmon.a /home/rhel8/allan/dev/ivcom/src/linux5_64_DBG/libivcom.a /home/rhel8/allan/dev/gslog/lib/linux5_64_DBG/libgslog-mt.a /home/rhel8/allan/dev/gscpputil/linux5_64_DBG/libgscpputil.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcre.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcrecpp.a /home/rhel8/allan/dev/gscushmdb/linux5_64_DBG/libgscushmdb.a /home/rhel8/allan/dev/hermes/lib/linux5_64_DBG/libhermescommandmanager.a /home/rhel8/allan/dev/hermes/lib/linux5_64_DBG/libhermescommon.a /home/rhel8/allan/dev/ivshmdb/api/linux5_64_DBG/libivshmdbapi.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libIvShmDbUserEnums.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libivshmdbcommanddefinition.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libIvShmDbUserRecords.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarapplication.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcurrenttime.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcommandlinetools.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlardatastreampair.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarflightrecorder.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarjournalmanager.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarmessagewrapper.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarreplicator.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarresources.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarsharedmemoryutils.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlartransaction.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlaruniqueid.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libKevlarUserEnums.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcommanddefinition.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libKevlarUserRecords.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libUserRecords.a -Wl,"-)" -lboost_filesystem -lboost_regex -lboost_program_options -lboost_date_time -lboost_system -lexpat /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcre.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcrecpp.a /usr/lib64/libpython2.7.so -pthread -Xlinker -ldl -ltirpc -lutil -lrt
-lboost_filesystem -lboost_regex -lboost_program_options -lboost_date_time -lboost_system -lexpat
this library are available in /usr/lib64 folder with so extension.
Below is the error when i compile with boost 1.66
Error after compiling with 1.66 boost version
/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o):(.data.rel.ro._ZTVN5boost15program_options11typed_valueISt6vectorISsSaISsEEcEE[_ZTVN5boost15program_options11typed_valueISt6vectorISsSaISsEEcEE]+0x38): undefined reference to boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o):(.data.rel.ro._ZTVN5boost15program_options11typed_valueISscEE[_ZTVN5boost15program_options11typed_valueISscEE]+0x38): undefined reference to boost::program_options::value_semantic_codecvt_helper::parse(boost::any&, std::vector<std::string, std::allocatorstd::string > const&, bool) const'
/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o):(.data.rel.ro._ZTVN5boost15program_options20invalid_option_valueE[_ZTVN5boost15program_options20invalid_option_valueE]+0x30): undefined reference to boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o):(.data.rel.ro._ZTVN5boost15program_options16validation_errorE[_ZTVN5boost15program_options16validation_errorE]+0x30): undefined reference to boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const'
/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o): In function boost::program_options::typed_value<std::vector<std::string, std::allocator<std::string> >, char>::name() const': /usr/include/boost/program_options/detail/value_semantic.hpp:22: undefined reference to boost::program_options::arg'
/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o): In function boost::program_options::typed_value<std::string, char>::name() const':/usr/include/boost/program_options/detail/value_semantic.hpp:22: undefined reference to boost::program_options::arg' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o): In function boost::program_options::typed_value<std::string, char>::xparse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&) const':/usr/include/boost/program_options/detail/value_semantic.hpp:184: undefined reference to boost::program_options::validate(boost::any&, std::vector<std::string, std::allocatorstd::string > const&, std::string*, int)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o): In function void boost::program_options::validate<std::string, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::string, std::allocator<std::string> >*, int)': /usr/include/boost/program_options/detail/value_semantic.hpp:149: undefined reference to boost::program_options::validate(boost::any&, std::vector<std::string, std::allocatorstd::string > const&, std::string*, int)' /usr/include/boost/program_options/detail/value_semantic.hpp:153: undefined reference to boost::program_options::invalid_option_value::invalid_option_value(std::string const&)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.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::string const&) const' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.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::string const&) const' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineTool.o): In function KevlarCommandLineTool::KevlarCommandLineTool(std::string const&, std::string const&)':/home/rhel8/allan/dev/timer/commandLineTools/KevlarCommandLineTool.cpp:12: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineTool.o): In function boost::program_options::basic_command_line_parser::basic_command_line_parser(int, char const* const*)': /usr/include/boost/program_options/detail/parsers.hpp:44: undefined reference to boost::program_options::detail::cmdline::cmdline(std::vector<std::string, std::allocator<std::string> > const&)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineTool.o): In function std::vector<std::string, std::allocatorstd::string > boost::program_options::to_internalstd::string(std::vector<std::string, std::allocatorstd::string > const&)': /usr/include/boost/program_options/detail/convert.hpp:79: undefined reference to boost::program_options::to_internal(std::string const&)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o): In function KevlarJournalEditor::KevlarJournalEditor(CureApplication*)': /home/rhel8/allan/dev/timer/commandLineTools/KevlarJournalEditor.cpp:36: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)' /home/rhel8/allan/dev/timer/commandLineTools/KevlarJournalEditor.cpp:36: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o): In function boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::string const&, std::string const&, int)': /usr/include/boost/program_options/errors.hpp:378: undefined reference to boost::program_options::validation_error::get_template(boost::program_options::validation_error::kind_t)' /usr/include/boost/program_options/errors.hpp:378: undefined reference to boost::program_options::error_with_option_name::error_with_option_name(std::string const&, std::string const&, std::string const&, int)'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o): In function boost::program_options::variables_map::operator[](std::string const&) const': /usr/include/boost/program_options/variables_map.hpp:155: undefined reference to boost::program_options::abstract_variables_map::operator[](std::string const&) const' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o):(.data.rel.ro._ZTVN5boost15program_options11typed_valueIicEE[_ZTVN5boost15program_options11typed_valueIicEE]+0x38): undefined reference to boost::program_options::value_semantic_codecvt_helper::parse(boost::any&, std::vector<std::string, std::allocatorstd::string > const&, bool) const'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o): In function boost::program_options::typed_value<int, char>::name() const':/usr/include/boost/program_options/detail/value_semantic.hpp:22: undefined reference to boost::program_options::arg' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o): In function void boost::program_options::validate<int, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int*, long)':/usr/include/boost/program_options/detail/value_semantic.hpp:95: undefined reference to boost::program_options::invalid_option_value::invalid_option_value(std::string const&)'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o):(.data.rel.ro._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::string const&) const'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o):(.data.rel.ro._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::string const&) const'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarShmDatabaseUtility.o): In function KevlarShmDatabaseUtility::KevlarShmDatabaseUtility()':/home/rhel8/allan/dev/timer/commandLineTools/KevlarShmDatabaseUtility.cpp:38: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'/home/rhel8/allan/dev/timer/commandLineTools/KevlarShmDatabaseUtility.cpp:38: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'/home/rhel8/allan/dev/timer/commandLineTools/KevlarShmDatabaseUtility.cpp:38: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarShmEditor.o): In function KevlarShmEditor::KevlarShmEditor(CureApplication*)':/home/rhel8/allan/dev/timer/commandLineTools/KevlarShmEditor.cpp:278: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'/home/rhel8/allan/dev/timer/commandLineTools/KevlarShmEditor.cpp:278: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarLogQueryTool.o):/home/rhel8/allan/dev/timer/commandLineTools/KevlarLogQueryTool.cpp:113: more undefined references to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)' follow/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarLogQueryTool.o):(.data.rel.ro._ZTVN5boost15program_options11typed_valueIjcEE[_ZTVN5boost15program_options11typed_valueIjcEE]+0x38): undefined reference to boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarLogQueryTool.o): In function boost::program_options::typed_value<unsigned int, char>::name() const':/usr/include/boost/program_options/detail/value_semantic.hpp:22: undefined reference to boost::program_options::arg'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarLogQueryTool.o): In function void boost::program_options::validate<unsigned int, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > > const&, unsigned int*, long)':/usr/include/boost/program_options/detail/value_semantic.hpp:95: undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::string const&)'collect2: error: ld returned 1 exit status

Compile time error: undefined reference to CryptoPP::StringStore::TransferTo2

I am trying to run a sample program to create a SHA-1 hash using Cryptopp library in C++.
I have installed these packages on my system (running Ubuntu 20.04):
sudo apt-get install libcrypto++-dev libcrypto++-doc libcrypto++-utils
Here's the code of sample program I'm trying to run:
// test.cpp
#include "cryptopp/cryptlib.h"
#include "cryptopp/sha.h"
#include "cryptopp/files.h"
#include "cryptopp/hex.h"
#include <iostream>
int main(int argc, char *argv[])
{
using namespace CryptoPP;
HexEncoder encoder(new FileSink(std::cout));
std::string msg = "Yoda said, Do or do not. There is no try.";
std::string digest;
SHA1 hash;
hash.Update((const byte *)msg.data(), msg.size());
digest.resize(hash.DigestSize());
hash.Final((byte *)&digest[0]);
std::cout << "Message: " << msg << std::endl;
std::cout << "Digest: ";
StringSource(digest, true, new Redirector(encoder));
std::cout << std::endl;
return 0;
}
Upon compiling the program with given command, I am getting these errors:
elon#starlink:~/$ g++ -o test test.cpp -lcryptopp -lpthread
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP12StringSourceE[_ZTVN8CryptoPP12StringSourceE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP12StringSourceE[_ZTVN8CryptoPP12StringSourceE]+0x128): undefined reference to `CryptoPP::Filter::TransferTo2(CryptoPP::BufferedTransformation&, unsigned long&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP12StringSourceE[_ZTVN8CryptoPP12StringSourceE]+0x130): undefined reference to `CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long&, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) const'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP14SourceTemplateINS_11StringStoreEEE[_ZTVN8CryptoPP14SourceTemplateINS_11StringStoreEEE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP14SourceTemplateINS_11StringStoreEEE[_ZTVN8CryptoPP14SourceTemplateINS_11StringStoreEEE]+0x128): undefined reference to `CryptoPP::Filter::TransferTo2(CryptoPP::BufferedTransformation&, unsigned long&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP14SourceTemplateINS_11StringStoreEEE[_ZTVN8CryptoPP14SourceTemplateINS_11StringStoreEEE]+0x130): undefined reference to `CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long&, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) const'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP14InputRejectingINS_6FilterEEE[_ZTVN8CryptoPP14InputRejectingINS_6FilterEEE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP14InputRejectingINS_6FilterEEE[_ZTVN8CryptoPP14InputRejectingINS_6FilterEEE]+0x128): undefined reference to `CryptoPP::Filter::TransferTo2(CryptoPP::BufferedTransformation&, unsigned long&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP14InputRejectingINS_6FilterEEE[_ZTVN8CryptoPP14InputRejectingINS_6FilterEEE]+0x130): undefined reference to `CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long&, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) const'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP17SimpleProxyFilterE[_ZTVN8CryptoPP17SimpleProxyFilterE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP17SimpleProxyFilterE[_ZTVN8CryptoPP17SimpleProxyFilterE]+0x128): undefined reference to `CryptoPP::Filter::TransferTo2(CryptoPP::BufferedTransformation&, unsigned long&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP17SimpleProxyFilterE[_ZTVN8CryptoPP17SimpleProxyFilterE]+0x130): undefined reference to `CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long&, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) const'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP23CustomSignalPropagationINS_4SinkEEE[_ZTVN8CryptoPP23CustomSignalPropagationINS_4SinkEEE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP22CustomFlushPropagationINS_4SinkEEE[_ZTVN8CryptoPP22CustomFlushPropagationINS_4SinkEEE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP11UnflushableINS_6FilterEEE[_ZTVN8CryptoPP11UnflushableINS_6FilterEEE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP11UnflushableINS_6FilterEEE[_ZTVN8CryptoPP11UnflushableINS_6FilterEEE]+0x128): undefined reference to `CryptoPP::Filter::TransferTo2(CryptoPP::BufferedTransformation&, unsigned long&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP11UnflushableINS_6FilterEEE[_ZTVN8CryptoPP11UnflushableINS_6FilterEEE]+0x130): undefined reference to `CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long&, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) const'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP10BufferlessINS_6FilterEEE[_ZTVN8CryptoPP10BufferlessINS_6FilterEEE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP10BufferlessINS_6FilterEEE[_ZTVN8CryptoPP10BufferlessINS_6FilterEEE]+0x128): undefined reference to `CryptoPP::Filter::TransferTo2(CryptoPP::BufferedTransformation&, unsigned long&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP10BufferlessINS_6FilterEEE[_ZTVN8CryptoPP10BufferlessINS_6FilterEEE]+0x130): undefined reference to `CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long&, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) const'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP4SinkE[_ZTVN8CryptoPP4SinkE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP13AutoSignalingINS_14InputRejectingINS_22BufferedTransformationEEEEE[_ZTVN8CryptoPP13AutoSignalingINS_14InputRejectingINS_22BufferedTransformationEEEEE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o:(.data.rel.ro._ZTVN8CryptoPP14InputRejectingINS_22BufferedTransformationEEE[_ZTVN8CryptoPP14InputRejectingINS_22BufferedTransformationEEE]+0xd8): undefined reference to `CryptoPP::BufferedTransformation::Skip(unsigned long)'
/usr/bin/ld: /tmp/ccZ6zru9.o: in function `CryptoPP::SourceTemplate<CryptoPP::StringStore>::Pump2(unsigned long&, bool)':
test.cpp:(.text._ZN8CryptoPP14SourceTemplateINS_11StringStoreEE5Pump2ERmb[_ZN8CryptoPP14SourceTemplateINS_11StringStoreEE5Pump2ERmb]+0x5b): undefined reference to `CryptoPP::StringStore::TransferTo2(CryptoPP::BufferedTransformation&, unsigned long&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
collect2: error: ld returned 1 exit status
Crypto++ Version:
elon#starlink:~/$ grep Library cryptopp/cryptlib.h
/*! \mainpage Crypto++ Library 8.5 API Reference
/// \details LibraryVersion can help detect inadvertent mixing and matching of library
. . .
g++ Version:
elon#starlink:~/$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
Does anyone know why the program fails to compile?
I have tried your codes and it seems that you need to include the header file "cryptopp/filters.h", after that, bugs may be solved.

How do I solve the 'makefile std error undefined reference' error?

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.

Undefined reference when using boost on WSL (Bash On Windows) [duplicate]

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