i am using proxygen library by facebook to build a simple client example . in a directory i have two object files how do i link them :
i am using:
g++ -std=c++11 -o my_echo CurlClientMain.o CurlClient.o -lproxygenhttpserver -lfolly -lglog -lgflags -pthread
i think i ma missing some linker flag like -lgflags in above example. maybe after including some -someflag will help out compilation . how do i know what all possilble library flags are posiible like the one they have used -lproxyhttpserver.
In short where is all these libs defined or located. i am using ubuntu.
Here is my error message
In function `main':
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::HTTPConnector(proxygen::HTTPConnector::Callback*, folly::HHWheelTimer*)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:102: undefined reference to `proxygen::HTTPConnector::connect(folly::EventBase*, folly::SocketAddress const&, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::~HTTPConnector()'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:99: undefined reference to `proxygen::HTTPConnector::connectSSL(folly::EventBase*, folly::SocketAddress const&, std::shared_ptr<folly::SSLContext> const&, ssl_session_st*, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&, std::string const&)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::~HTTPConnector()'
CurlClient.o: In function `CurlService::CurlClient::connectSuccess(proxygen::HTTPUpstreamSession*)':
/home/kshitij/proxygen/httpclient/samples/curl/CurlClient.cpp:69: undefined reference to `proxygen::HTTPUpstreamSession::newTransaction(proxygen::HTTPTransactionHandler*)'
collect2: error: ld returned 1 exit status
kshitij#forgetit:~/proxygen/httpclient/samples/curl$ g++ -std=c++11 -o my_echo CurlClientMain.o CurlClient.o -lproxygenhttpserver -lfolly -lglog -lgflags -pthread
CurlClientMain.o: In function `main':
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::HTTPConnector(proxygen::HTTPConnector::Callback*, folly::HHWheelTimer*)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:102: undefined reference to `proxygen::HTTPConnector::connect(folly::EventBase*, folly::SocketAddress const&, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::~HTTPConnector()'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:99: undefined reference to `proxygen::HTTPConnector::connectSSL(folly::EventBase*, folly::SocketAddress const&, std::shared_ptr<folly::SSLContext> const&, ssl_session_st*, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&, std::string const&)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::~HTTPConnector()'
CurlClient.o: In function `CurlService::CurlClient::connectSuccess(proxygen::HTTPUpstreamSession*)':
/home/kshitij/proxygen/httpclient/samples/curl/CurlClient.cpp:69: undefined reference to `proxygen::HTTPUpstreamSession::newTransaction(proxygen::HTTPTransactionHandler*)'
collect2: error: ld returned 1 exit status
how do i know what all possilble library flags are posiible like the one they have used -lproxyhttpserver.
It depends on your compilation environment.
You appear to use the GNU compiler in linux. There is a tool to list all installed shared libraries:
ldconfig -p
You will get a list of lines like this
libpthread.so.0 (libc6,x86-64, OS ABI: Linux 2.6.32) => /lib/x86_64-linux-gnu/libpthread.so.0
Remove the lib prefix and the extension .so.X and you get the name of the library. In this case it's pthread. To link with a libray use the option -lNAME. So, -lpthread in this example.
In short where is all these libs defined or located
The righthand part of the => is the full path to the library.
Related
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*)'
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
I have correctly installed crfsuite from source (https://github.com/downloads/chokkan/crfsuite/crfsuite-0.12.tar.gz).
But when I try to compile a very simple code, it seems that I have missed something.
Here is the code:
#include "crfsuite.hpp"
using namespace CRFSuite;
int main(int argc, char *argv[])
{
Tagger tagger;
}
Here's the command line to compile:
g++ -L/usr/local/lib -I/usr/local/include -lcrfsuite tagging.cpp
and the error:
/tmp/ccIkvCFv.o: In function `CRFSuite::Trainer::Trainer()':
tagging.cpp:(.text+0x48): undefined reference to `crfsuite_data_init'
/tmp/ccIkvCFv.o: In function `CRFSuite::Trainer::init()':
tagging.cpp:(.text+0x149): undefined reference to `crfsuite_create_instance'
tagging.cpp:(.text+0x1b7): undefined reference to `crfsuite_create_instance'
/tmp/ccIkvCFv.o: In function `CRFSuite::Trainer::clear()':
tagging.cpp:(.text+0x2dd): undefined reference to `crfsuite_data_finish'
tagging.cpp:(.text+0x2ed): undefined reference to `crfsuite_data_init'
/tmp/ccIkvCFv.o: In function `CRFSuite::Trainer::append(std::vector<std::vector<CRFSuite::Attribute, std::allocator<CRFSuite::Attribute> >, std::allocator<std::vector<CRFSuite::Attribute, std::allocator<CRFSuite::Attribute> > > > 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> > > > const&, int)':
tagging.cpp:(.text+0x495): undefined reference to `crfsuite_instance_init_n'
tagging.cpp:(.text+0x51f): undefined reference to `crfsuite_item_init_n'
tagging.cpp:(.text+0x69b): undefined reference to `crfsuite_data_append'
tagging.cpp:(.text+0x6aa): undefined reference to `crfsuite_instance_finish'
/tmp/ccIkvCFv.o: In function `CRFSuite::Trainer::select(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&)':
tagging.cpp:(.text+0x7e9): undefined reference to `crfsuite_create_instance'
/tmp/ccIkvCFv.o: In function `CRFSuite::Tagger::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
tagging.cpp:(.text+0x11a0): undefined reference to `crfsuite_create_instance_from_file'
/tmp/ccIkvCFv.o: In function `CRFSuite::Tagger::set(std::vector<std::vector<CRFSuite::Attribute, std::allocator<CRFSuite::Attribute> >, std::allocator<std::vector<CRFSuite::Attribute, std::allocator<CRFSuite::Attribute> > > > const&)':
tagging.cpp:(.text+0x16c6): undefined reference to `crfsuite_instance_init_n'
tagging.cpp:(.text+0x1731): undefined reference to `crfsuite_item_init'
tagging.cpp:(.text+0x17e1): undefined reference to `crfsuite_attribute_set'
tagging.cpp:(.text+0x17f4): undefined reference to `crfsuite_item_append_attribute'
tagging.cpp:(.text+0x1854): undefined reference to `crfsuite_instance_finish'
tagging.cpp:(.text+0x18ac): undefined reference to `crfsuite_instance_finish'
collect2: error: ld returned 1 exit status
The paths are correct (/usr/local/lib, /usr/local/include)
The order of arguments matters. The library should go after your cpp file:
g++ -L/usr/local/lib -I/usr/local/include tagging.cpp -lcrfsuite
See the answer Why does the order in which libraries are linked sometimes cause errors in GCC? for more information.
hi i am using proxygen by facebook to create a simple hhtpclient . i am trying to run their default httpclient example. I am using the following command to build it:
g++ -std=c++11 -o my_echo CurlClient.o CurlClientMain.o -lproxygenhttpserver -lfolly -lglog -lgflags -pthread
but i am getting the following error:
CurlClient.o: In function `CurlService::CurlClient::connectSuccess(proxygen::HTTPUpstreamSession*)':
/home/kshitij/proxygen/httpclient/samples/curl/CurlClient.cpp:69: undefined reference to `proxygen::HTTPUpstreamSession::newTransaction(proxygen::HTTPTransactionHandler*)'
CurlClientMain.o: In function `main':
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::HTTPConnector(proxygen::HTTPConnector::Callback*, folly::HHWheelTimer*)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:102: undefined reference to `proxygen::HTTPConnector::connect(folly::EventBase*, folly::SocketAddress const&, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::~HTTPConnector()'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:99: undefined reference to `proxygen::HTTPConnector::connectSSL(folly::EventBase*, folly::SocketAddress const&, std::shared_ptr<folly::SSLContext> const&, ssl_session_st*, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&, std::string const&)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::~HTTPConnector()'
collect2: error: ld returned 1 exit status
what could be the possible error. correct me if i am building it the wrong way.
g++ -std=c++11 -o my_echo CurlClient.o CurlClientMain.o HttpUpstreamSession.o -lproxygenhttpserver -lfolly -lglog -lgflags -pthread
The HttpUpstreamSession.h include is referenced but the implementation is defined in its .cpp in the same directory. You need to either build the .cpp or use the .o file in your build.
What I used to compile that example:
gcc -I/usr/local/include -o a.out CurlClientMain.cpp CurlClient.cpp -L/usr/local/lib -lglog -lgflags -lstdc++ -lfolly -lproxygenlib -lpthread -lcrypto -lssl -lz -lwangle
Note the inclusion of libproxygenlib.
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.....