编译cpp-netlib源时出错

时间:2016-03-13 10:10:33

标签: c++ compilation cpp-netlib

我已按照documentation中的说明安装了c ++网络库,我正在尝试手动编译http client示例。我正在使用库的0.11版本。

我正在使用此命令进行编译:

g++ -o http_c     http_client.cpp     -lcppnetlib-uri     -lcppnetlib-server-parsers     -lcppnetlib-client-connections     -lboost_thread     -I/usr/local/include     -L/usr/local/lib64

我收到此错误:

In file included from /usr/include/boost/iostreams/detail/is_dereferenceable.hpp:12:0,
                 from /usr/include/boost/iostreams/detail/resolve.hpp:26,
                 from /usr/include/boost/iostreams/detail/push.hpp:24,
                 from /usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /usr/include/boost/iostreams/stream_buffer.hpp:22,
                 from /usr/include/boost/iostreams/stream.hpp:21,
                 from /usr/include/boost/spirit/home/qi/stream/detail/iterator_source.hpp:14,
                 from /usr/include/boost/spirit/home/qi/stream/stream.hpp:16,
                 from /usr/include/boost/spirit/home/qi/stream.hpp:15,
                 from /usr/include/boost/spirit/home/qi.hpp:30,
                 from /usr/include/boost/spirit/include/qi.hpp:16,
                 from /usr/local/include/boost/network/uri/accessors.hpp:12,
                 from /usr/local/include/boost/network/uri/uri.hpp:308,
                 from /usr/local/include/boost/network/protocol/http/message/wrappers/uri.hpp:10,
                 from /usr/local/include/boost/network/protocol/http/request.hpp:18,
                 from /usr/local/include/boost/network/protocol/http/client.hpp:13,
                 from http_client.cpp:1:
/usr/include/boost/type_traits/detail/bool_trait_def.hpp:18:79: note: #pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated
 # pragma message("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")
                                                                               ^
In file included from /usr/include/boost/type_traits/detail/bool_trait_def.hpp:21:0,
                 from /usr/include/boost/iostreams/detail/is_dereferenceable.hpp:12,
                 from /usr/include/boost/iostreams/detail/resolve.hpp:26,
                 from /usr/include/boost/iostreams/detail/push.hpp:24,
                 from /usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /usr/include/boost/iostreams/stream_buffer.hpp:22,
                 from /usr/include/boost/iostreams/stream.hpp:21,
                 from /usr/include/boost/spirit/home/qi/stream/detail/iterator_source.hpp:14,
                 from /usr/include/boost/spirit/home/qi/stream/stream.hpp:16,
                 from /usr/include/boost/spirit/home/qi/stream.hpp:15,
                 from /usr/include/boost/spirit/home/qi.hpp:30,
                 from /usr/include/boost/spirit/include/qi.hpp:16,
                 from /usr/local/include/boost/network/uri/accessors.hpp:12,
                 from /usr/local/include/boost/network/uri/uri.hpp:308,
                 from /usr/local/include/boost/network/protocol/http/message/wrappers/uri.hpp:10,
                 from /usr/local/include/boost/network/protocol/http/request.hpp:18,
                 from /usr/local/include/boost/network/protocol/http/client.hpp:13,
                 from http_client.cpp:1:
/usr/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
In file included from /usr/include/boost/iostreams/detail/is_dereferenceable.hpp:13:0,
                 from /usr/include/boost/iostreams/detail/resolve.hpp:26,
                 from /usr/include/boost/iostreams/detail/push.hpp:24,
                 from /usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /usr/include/boost/iostreams/stream_buffer.hpp:22,
                 from /usr/include/boost/iostreams/stream.hpp:21,
                 from /usr/include/boost/spirit/home/qi/stream/detail/iterator_source.hpp:14,
                 from /usr/include/boost/spirit/home/qi/stream/stream.hpp:16,
                 from /usr/include/boost/spirit/home/qi/stream.hpp:15,
                 from /usr/include/boost/spirit/home/qi.hpp:30,
                 from /usr/include/boost/spirit/include/qi.hpp:16,
                 from /usr/local/include/boost/network/uri/accessors.hpp:12,
                 from /usr/local/include/boost/network/uri/uri.hpp:308,
                 from /usr/local/include/boost/network/protocol/http/message/wrappers/uri.hpp:10,
                 from /usr/local/include/boost/network/protocol/http/request.hpp:18,
                 from /usr/local/include/boost/network/protocol/http/client.hpp:13,
                 from http_client.cpp:1:
/usr/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
/usr/bin/ld: /tmp/cczusVNF.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/libboost_system.so.1.60.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

我不知道发生了什么。

1 个答案:

答案 0 :(得分:1)

有关已弃用标头的提示警告可以忽略,它们是boost 1.60.0的已知问题。

这将为您提供对boost系统库的未定义引用。您是否真的在系统上安装了正在使用的boost库?这可能会解决您的问题。安装是特定于操作系统的,请启动here