Quantcast

Undefined refs when compiling trivial example

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Undefined refs when compiling trivial example

Boost - Dev mailing list
Hello,

I took the trivial example from http://www.boost.org/doc/libs/1_63_0/libs/log/example/doc/tutorial_trivial.cpp and try
to compile it.

boost 1.63 is compiled by myself without any special options, besides --prefix.

% echo $LD_LIBRARY_PATH
/home/lindnefn/software/boost/lib:

% echo $LIBRARY_PATH
/home/lindnefn/software/boost/lib:

% echo $CPLUS_INCLUDE_PATH
/home/lindnefn/software/boost/include:

the LIBRARY_PATH contains all the *.so and *.a files, the INCLUDE_PATH/boost all the headers.

but compiling fails:

lindnefn@helium ~ % g++ -std=c++11 -DBOOST_ALL_DYN_LINK -pthread -lboost_log_setup -lboost_log -lboost_thread
-lboost_filesystem  boostlog_trivial.cpp

/tmp/ccUc6CtH.o: In function `main':
boostlog_trivial.cpp:(.text+0x48): undefined reference to `boost::log::v2_mt_posix::trivial::logger::get()'
boostlog_trivial.cpp:(.text+0x76): undefined reference to `boost::log::v2_mt_posix::trivial::logger::get()'
boostlog_trivial.cpp:(.text+0xe8): undefined reference to `boost::log::v2_mt_posix::trivial::logger::get()'
boostlog_trivial.cpp:(.text+0x116): undefined reference to `boost::log::v2_mt_posix::trivial::logger::get()'
boostlog_trivial.cpp:(.text+0x188): undefined reference to `boost::log::v2_mt_posix::trivial::logger::get()'
/tmp/ccUc6CtH.o:boostlog_trivial.cpp:(.text+0x1b6): more undefined references to
`boost::log::v2_mt_posix::trivial::logger::get()' follow
/tmp/ccUc6CtH.o: In function `boost::log::v2_mt_posix::record::reset()':
boostlog_trivial.cpp:(.text._ZN5boost3log11v2_mt_posix6record5resetEv[_ZN5boost3log11v2_mt_posix6record5resetEv]+0x23):
undefined reference to
`boost::log::v2_mt_posix::record_view::public_data::destroy(boost::log::v2_mt_posix::record_view::public_data const*)'
/tmp/ccUc6CtH.o: In function `boost::log::v2_mt_posix::record
boost::log::v2_mt_posix::sources::basic_composite_logger<char,
boost::log::v2_mt_posix::sources::severity_logger_mt<boost::log::v2_mt_posix::trivial::severity_level>,
boost::log::v2_mt_posix::sources::multi_thread_model<boost::log::v2_mt_posix::aux::light_rw_mutex>,
boost::log::v2_mt_posix::sources::features<boost::log::v2_mt_posix::sources::severity<boost::log::v2_mt_posix::trivial::severity_level>
> >::open_record<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::severity,
boost::log::v2_mt_posix::trivial::severity_level const>
>(boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::severity,
boost::log::v2_mt_posix::trivial::severity_level const> const&)':
boostlog_trivial.cpp:(.text._ZN5boost3log11v2_mt_posix7sources22basic_composite_loggerIcNS2_18severity_logger_mtINS1_7trivial14severity_levelEEENS2_18multi_thread_modelINS1_3aux14light_rw_mutexEEENS2_8featuresIJNS2_8severityIS6_EEEEEE11open_recordINS_9parameter3aux15tagged_argumentINS1_8keywords3tag8severityEKS6_EEEENS1_6recordERKT_[_ZN5boost3log11v2_mt_posix7sources22basic_composite_loggerIcNS2_18severity_logger_mtINS1_7trivial14severity_levelEEENS2_18multi_thread_modelINS1_3aux14light_rw_mutexEEENS2_8featuresIJNS2_8severityIS6_EEEEEE11open_recordINS_9parameter3aux15tagged_argumentINS1_8keywords3tag8severityEKS6_EEEENS1_6recordERKT_]+0x3c):
undefined reference to `boost::log::v2_mt_posix::core::get_logging_enabled() const'
/tmp/ccUc6CtH.o: In function
`boost::log::v2_mt_posix::aux::record_pump<boost::log::v2_mt_posix::sources::severity_logger_mt<boost::log::v2_mt_posix::trivial::severity_level>
>::~record_pump()':
boostlog_trivial.cpp:(.text._ZN5boost3log11v2_mt_posix3aux11record_pumpINS1_7sources18severity_logger_mtINS1_7trivial14severity_levelEEEED2Ev[_ZN5boost3log11v2_mt_posix3aux11record_pumpINS1_7sources18severity_logger_mtINS1_7trivial14severity_levelEEEED5Ev]+0x4b):
undefined reference to `boost::log::v2_mt_posix::aux::unhandled_exception_count()'
[...]

I also tried to omit -DBOOST_ALL_DYN_LINK, add -static instead or use clang++ instead of g++. I also tried to shuffle
the order of -l ... All gives the same error.

Build machine is a Ubuntu 16.04.4 , g++ 5.4.0.

What could be wrong?

Thanks,
Florian

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Undefined refs when compiling trivial example

Boost - Dev mailing list
Florian Lindner wrote:
> but compiling fails:
>
> lindnefn@helium ~ %
> g++ -std=c++11 -DBOOST_ALL_DYN_LINK -pthread -lboost_log_setup -lboost_log
>  -lboost_thread -lboost_filesystem  boostlog_trivial.cpp

Try moving boostlog_trivial.cpp before the -l options. Order is significant;
only -l after are searched.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Loading...