Code:
----------------
#include <boost/asio.hpp>
int main()
{
return 0;
}
----------------
Compile Messages and Errors:
----------------
cd '/home/lance/TS1/debug' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1"
LC_MESSAGES="C" LC_CTYPE="C" make -k
make all-recursive
Making all in src
compiling ts1.cpp (g++)
mv -f .deps/ts1.Tpo .deps/ts1.Po
linking ts1 (g++)
linking ts1 (g++)
ts1.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:205: undefined reference to
`boost::system::get_system_category()'
/usr/include/boost/system/error_code.hpp:206: undefined reference to
`boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:211: undefined reference to
`boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:212: undefined reference to
`boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:213: undefined reference to
`boost::system::get_system_category()'
ts1.o: In function `boost::asio::error::get_system_category()':
/usr/include/boost/asio/error.hpp:218: undefined reference to
`boost::system::get_system_category()'
ts1.o: In function `posix_tss_ptr':
/usr/include/boost/asio/detail/posix_tss_ptr.hpp:47: undefined reference to
`pthread_key_create'
ts1.o: In function `~posix_tss_ptr':
/usr/include/boost/asio/detail/posix_tss_ptr.hpp:61: undefined reference to
`pthread_key_delete'
collect2: ld returned 1 exit status
make[2]: *** [ts1] Error 1
make[2]: Target `all' not remade because of errors.
make[2]: Nothing to be done for `all-am'.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
*** Exited with status: 2 ***
----------------
How do I resolve the boost::system errors?
Thanks,
Lance
--
View this message in context: http://www.nabble.com/Noob-question---undefined-reference-to-boost%3A%3Asystem%3A%3Aget_system_category-tp23673473p23673473.html
Sent from the Boost - Users mailing list archive at Nabble.com.
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
mx270a wrote:
> I'm a relatively new to programming on Linux, previous experience was with
> VB.net in Windows. I'm trying to make the switch to C++, but I'm having a
> difficult time. I started to follow one of the basic tutorials for Boost
> ASIO, but I can't get it to compile with the ASIO.hpp file included. The
> environment is Kubuntu 9.04 and Kdevelop 3.5.3.
>
>
> Code:
> ----------------
> #include <boost/asio.hpp>
>
> int main()
> {
> return 0;
> }
> ----------------
>
>
> Compile Messages and Errors:
> <snip>
> /usr/include/boost/system/error_code.hpp:205: undefined reference to
> `boost::system::get_system_category()'
You'll need to follow the instructions at
http://tinyurl.com/ypdqsh
and build the boost system library.
In Christ,
Steven Watanabe
Lance -
You need to link against the boost system library also.
Michael
--
----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com
Michael Caisse-2 wrote:
>
> You need to link against the boost system library also.
>
How do I do that? I tried adding #include <boost/system.hpp> to the program,
but there is no file by that name.
-Lance
--
View this message in context: http://www.nabble.com/Noob-question---undefined-reference-to-boost%3A%3Asystem%3A%3Aget_system_category-tp23673473p23675752.html
Sent from the Boost - Users mailing list archive at Nabble.com.
_______________________________________________
Lance -
You need to *link* the system library. For example, it might be called
libboost_system-gcc43-mt-1_37.so.
See Steven's response which pointed you toward the Getting Started guide.
Michael
--
----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com
Alternatively it's possible to use the non-boost asio, which is header-only:
http://blog.think-async.com/2008/05/boostasio-vs-asio.html