--
You received this message because you are subscribed to the Google Groups "nxweb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nxweb+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
1. edit ./nxweb-3.2.0-dev/src/bin/Makefile.am:
nxweb_SOURCES = main.c modules/mymodule1.c modules/mymodule2.cpp
nxweb_LDADD = $(top_srcdir)/src/lib/.libs/libnxweb.a $(NXWEB_EXT_LIBS)
2. edit ./nxweb-3.2.0-dev/configure.ac,add one line:
AC_PROG_CC([gcc])
AC_PROG_LIBTOOL
AC_PROG_CXX([g++])
3. build all:
# aclocal
# autoconf
# automake --add-missing
# ./configure
# make
# autoreconf -ivf(if make report that lib tool not match,run this command)
# make
# make install
Cheers
#include "nxweb/nxweb.h" in
your c++ file#include <string>
extern "C" {
#include <stdbool.h>
#include "nxweb/nxweb.h"
static nxweb_result main_on_request(nxweb_http_server_connection* conn, nxweb_http_request* req, nxweb_http_response* resp) {
nxweb_set_response_content_type(resp, "text/html");
std::string someText = "Hello, world";
const char* page_content = someText.c_str();
nxweb_response_printf(resp, "%H", page_content);
return NXWEB_OK;
}
NXWEB_DEFINE_HANDLER(main, .on_request=main_on_request,
.flags = (nxweb_handler_flags) (NXWEB_HANDLE_ANY|NXWEB_PARSE_PARAMETERS|NXWEB_PARSE_COOKIES));
}
For more options, visit https://groups.google.com/d/optout.
In file included from /usr/local/include/nxweb/nx_buffer.h:32:0,
from /usr/local/include/nxweb/nxweb.h:39,
from main.cpp:9:
/usr/local/include/nxweb/misc.h:56:3: error: ‘_Bool’ does not name a type
_Bool error_log_level_set:1;
^
> I am not sure about clang as nxweb uses some gcc extensions (perhaps clang implements them too). Does your handler actually work?
Sorry, I misunderstood your question. Please find below the error messages I get from g++ 4.8.4 under Ubuntu 14.04.1.
In file included from /usr/local/include/nxweb/nxweb.h:229:0,
from main.cpp:6:
main.cpp:16:1: sorry, unimplemented: non-trivial designated initializers not supported
NXWEB_DEFINE_HANDLER(main, .on_request=main_on_request,
^
main.cpp:16:1: sorry, unimplemented: non-trivial designated initializers not supported