2011-07-15 21 views
1

CPP-netlibのV0.9をコンパイルするとき、私は、Visual Studio 2010からcpp-netlibライブラリーを構築するが、次のリンカエラーを取得しようとしています:未解決の外部シンボルエラー

error LNK2019: unresolved external symbol "bool __cdecl boost::network::uri::detail::parse_uri_impl(class boost::iterator_range,class std::allocator > > &,struct boost::network::uri::detail::uri_parts_default_base &,struct boost::network::tags::default_string)" ([email protected]@[email protected]@[email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected][email protected]@[email protected]@[email protected]@Z) referenced in function "bool __cdecl boost::network::uri::detail::parse_uri,class std::allocator >,struct boost::network::http::tags::http_default_8bit_tcp_resolve>(class std::basic_string,class std::allocator > &,struct boost::network::uri::detail::uri_parts &)" ([email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@@[email protected]@Z)

このことを上がって掘りを少し私が使用しているBoostのバージョン(1.46.1)に関連する可能性がありますが、私は1.47.0と1.45.0の両方に対してコンパイルを試み、同じエラーが発生しました。

このライブラリをコンパイルするには何が必要ですか?私のような私のCPP-netlibのヘッダを前に、そのマクロ定義を追加した場合、私はコンパイルすることができる午前

  1. An option to turn off the required external library to be linked with a macro (BOOST_NETWORK_NO_LIB). With this macro defined before any cpp-netlib headers are included (or on the command line) the functions that were made extern or just free functions at namespace level are marked 'inline' and have their definitions pulled in accordingly in each translation unit. This addresses Jeff Garland's and others' concern of the need for an external library when using cpp-netlib when it's always been header-only until 0.9. I'm still wrestling with the thought of making the header-only behavior a default, but I'm not married to the "external library as default" decision either.

を:

+0

私はブーストに問題はないようですが、cpp-netlib(あなたのインストールでは、とにかく)を使っています。 –

答えて

3

は、検索の多くの後、私は言及、ライブラリの作成者からthisポストとthis 1を発見しましたそう:

#define BOOST_NETWORK_NO_LIB 

#include <boost/network/protocol/http/client.hpp> 

第2のポストで、私もそれがよりよい解決策かもしれないように聞こえる「あなたは、URIライブラリに対する/リンクを構築する必要がある」のが言及されました。

残念ながら、C++とブーストについての私の知識は最高ではないので、私はちょうどうまくいったものと一緒に行きました。

私が本当にやりたかったのは、図書館をコンパイルして実際に使用するために評価することができたからです。私は今、満足しています。

+0

これはBoostの問題ではありません。そして、DeanがBoostの問題だと言うあなたの言及への言及を見つけることができません。 cpp-netlibはBoostライブラリではないので、構築することはBoostの問題です!構築がうまくいかない場合は、cpp-netlibまたはそのドキュメンテーションに問題があるように見えます。 – GrafikRobot

+0

@GrafikRobotあなたは正しいです - 私がDeanにリンクしている投稿の1つに「残念ですが、これは修正されません。これは、 Boost.Spiritの実装で破損しています。うまくいけば1.47では動作しますが、 その間にBoost 1.45.0でcpp-netlibを使用してください。とにかく別の問題に言及していたと思います。最終的には問題はcpp-netlibのドキュメントにあります。これは私が個人的には使いにくかったですが、これは最高の(そうでなければ)C++ http libのように見えるので、残念です。 –

+0

@GrafikRobot実際、私は引用符を見つけた3番目の記事を読んでいました。https://groups.google.com/group/cpp-netlib/browse_thread/thread/08c9541e6259e8cf#は完全に無関係です。これらのコメントは削除されます(実際には誰の批判でもなく、同じ問題に取り組んでいる他の人々へのポインタではありませんが、それは不十分です)。 –