我正在尝试使用Boost的cpp-netlib编写一个超级小程序来解析示例C++文件中的HTTP URL。如何在我的C++代码中包含boost项目
的代码是微不足道的:
#include <boost/network/uri>
#include <iostream>
using namespace boost::network;
int main() {
uri::uri instance("http://www.example.com");
std::cout << "scheme: " << instance.scheme() << std::endl
<< "host: " << instance.host() << std::endl;
return 0;
}
我的测试代码是在同一目录下,升压源。要编译我简单地做:
g++ -Icpp-netlib-0.12.0-final -o test test.cpp
它没有找到包括与-I
虽然过去了,我得到一个致命的错误。
fatal error: 'boost/network/uri' file not found
#include <boost/network/uri>
^
1 error generated.
什么是正确的方法来做到这一点,开始使用他们的库编写示例代码?
我不知道增强多少,但你确定你应该使用boost/network/uri而不是'boost/network/uri.hpp'吗? – MikeCAT
这给了我一个新的错误。致命错误:'#include'我在'boost/network/uri /'中看到了'config.hpp',但是在目录中没有看到'boost/config.hpp'。 –
randombits
我认为你的提升安装被破坏了。也许你没有安装开发包? – drescherjm