I apologize in advance, my C++ is fairly weak. I was trying to make a
simple http server using cpp netlib v.0.8. The first problem I ran into was
the undefined "_or" problem, which I got around by including foreach.hpp (I
believe the other thread recommended #include <boost/mpl/or.hpp> which I'm
sure is a more direct solution).
Anyhow, I haven't been able to figure out how to fix my second problem.
Here is the code, which I've stripped down to the "Hello World" example.
I'm working with Visual Studio 2008.
I receive the error:
Error 1 error C2039: 'path' : is not a member of
'boost::network::http::basic_request<boost::network::http::tags::http_server>'
d:\dev\c++\lib\boost\boost_1_44\boost\network\protocol\http\message\wrappers\path.hpp
CPPNetLibTest 27
I think it has something to do with the forward declaration of basic_request
in path.hpp, and the fact that path.hpp tries to access path() before it is
fully defined (but like I said, my C++ is weak). I tried replacing the
forward declaration with various attempts at a #include, but I ran into
hosts of other problems with that.
Can anyone recommend an easy solution?
Thanks in advance.
- Tim Stewart.
// CPPNetLibTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <boost/foreach.hpp>
#include <boost/network/include/http/server.hpp>
struct handler_type;
typedef boost::network::http::server<handler_type> http_server;
struct handler_type {
void operator()(
http_server::request const & request,
http_server::response & response
) {
std::string pathstr = path(request);
// do something here depending on the path requested.
}
};
int _tmain(int argc, _TCHAR* argv[])
{
handler_type handler;
http_server server("127.0.0.1", "8000", handler);
server.run();
return 0;
}
|