Lance Lefebure
2009-05-25 03:53:58 UTC
Greetings. I'm relatively new to C/C++ and I'm trying to get the
hellobrowser example to work. I'm using libmicrohttpd-0.4.2 and my
environment is Kubuntu 9.04 with Kdevelop 3.5.3. I start a new C++ project
and insert the contents of /doc/examples/hellobrowser.c. That tells me I
need to get platform.h and microhttpd.h, so I grab those from /src/include/,
along with plibc.h and put them in my program's src directory. I then find
that I need MHD_config.h. I find a file with that name and a ".in" extension
in the root of the downloaded file, so I rename it and copy to my program's
src directory.
Next, when I try to build the app, I get these errors:
ts3.o: In function `main':
/home/lance/TS3/src/ts3.cpp:31: undefined reference to `MHD_start_daemon'
/home/lance/TS3/src/ts3.cpp:37: undefined reference to `MHD_stop_daemon'
ts3.o: In function `answer_to_connection(void*, MHD_Connection*, char
const*, char const*, char const*, char const*, unsigned int*, void**)':
/home/lance/TS3/src/ts3.cpp:18: undefined reference to
`MHD_create_response_from_data'
/home/lance/TS3/src/ts3.cpp:19: undefined reference to `MHD_queue_response'
/home/lance/TS3/src/ts3.cpp:20: undefined reference to
`MHD_destroy_response'
I find that I can resolve the undefined reference messages by locating each
of those functions in microhttpd.h, removing the trailing semi colon, and
adding a { } to it. I figured this was something to do with C code in C++,
although I now realize the problem is deeper.
That resolves my errors, I can built the program, it starts, but isn't
listening on the port like it should be. I then notice that the functions in
microhttpd.h don't seem to do anything. I look around and notice that in the
folder /src/daemon/ there are a bunch of .c and .h files that look useful,
but I have no idea how to use them.
I'm lost here. Any insight would be much appreciated.
Thanks,
Lance
hellobrowser example to work. I'm using libmicrohttpd-0.4.2 and my
environment is Kubuntu 9.04 with Kdevelop 3.5.3. I start a new C++ project
and insert the contents of /doc/examples/hellobrowser.c. That tells me I
need to get platform.h and microhttpd.h, so I grab those from /src/include/,
along with plibc.h and put them in my program's src directory. I then find
that I need MHD_config.h. I find a file with that name and a ".in" extension
in the root of the downloaded file, so I rename it and copy to my program's
src directory.
Next, when I try to build the app, I get these errors:
ts3.o: In function `main':
/home/lance/TS3/src/ts3.cpp:31: undefined reference to `MHD_start_daemon'
/home/lance/TS3/src/ts3.cpp:37: undefined reference to `MHD_stop_daemon'
ts3.o: In function `answer_to_connection(void*, MHD_Connection*, char
const*, char const*, char const*, char const*, unsigned int*, void**)':
/home/lance/TS3/src/ts3.cpp:18: undefined reference to
`MHD_create_response_from_data'
/home/lance/TS3/src/ts3.cpp:19: undefined reference to `MHD_queue_response'
/home/lance/TS3/src/ts3.cpp:20: undefined reference to
`MHD_destroy_response'
I find that I can resolve the undefined reference messages by locating each
of those functions in microhttpd.h, removing the trailing semi colon, and
adding a { } to it. I figured this was something to do with C code in C++,
although I now realize the problem is deeper.
That resolves my errors, I can built the program, it starts, but isn't
listening on the port like it should be. I then notice that the functions in
microhttpd.h don't seem to do anything. I look around and notice that in the
folder /src/daemon/ there are a bunch of .c and .h files that look useful,
but I have no idea how to use them.
I'm lost here. Any insight would be much appreciated.
Thanks,
Lance