Embed API and hello.c example incompatible

137 views
Skip to first unread message

Antonws

unread,
Dec 6, 2013, 11:00:06 PM12/6/13
to mongoos...@googlegroups.com
Hi.
Files of API mongoose.h and mongoose.c are incompatible with an example of hello.c.
There is wrong order of parameters and some other errors.
Can you please provide a working example of simple "hello mongoose" program that embeds API files?

Thank in advance,

Sergey Lyubka

unread,
Dec 7, 2013, 4:59:09 AM12/7/13
to mongoose-users
Could you elaborate on what is wrong, please?

If you use HEAD version of the git repo, everything works as expected.
"cd examples && make" builds all examples, including hello.c with no errors/warnings.
Compiled hello.c also works as expected.


--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-user...@googlegroups.com.
To post to this group, send email to mongoos...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/groups/opt_out.

Jason

unread,
Dec 21, 2013, 3:45:56 PM12/21/13
to mongoos...@googlegroups.com
He means this:
$ cc mongoose.c main.c -o app
main.c: In function ‘main’:
main.c:3:30: warning: initialization makes pointer from integer without a cast [enabled by default]
   struct mg_server *server = mg_create_server(NULL);
                              ^
/tmp/ccsmxI2D.o: In function `mg_start_thread':
mongoose.c:(.text+0x130c): undefined reference to `pthread_create'
/tmp/ccsmxI2D.o: In function `load_dll':
mongoose.c:(.text+0xb6d1): undefined reference to `dlopen'
mongoose.c:(.text+0xb730): undefined reference to `dlsym'
/tmp/ccsLJhGQ.o: In function `main':
main.c:(.text+0x13): undefined reference to `mg_create_server'
main.c:(.text+0x34): undefined reference to `mg_set_option'
main.c:(.text+0x4f): undefined reference to `mg_set_option'
main.c:(.text+0x65): undefined reference to `mg_poll_server'
collect2: error: ld returned 1 exit status

Jason

unread,
Dec 21, 2013, 3:47:12 PM12/21/13
to mongoos...@googlegroups.com

Sergey Lyubka

unread,
Dec 21, 2013, 3:56:02 PM12/21/13
to mongoose-users
If you checkout mongoose and do it the top directory
cc mongoose.c build/main.c -I.
That will work without errors or warnings. build/main.c is the only main.c file
in the repository.

Please make sure your repo is in sync.

Sergey Lyubka

unread,
Dec 21, 2013, 4:00:10 PM12/21/13
to mongoose-users
Please use

as it specified in the example. These are current sources, and documentation
reflects current sources.

Jason

unread,
Dec 21, 2013, 4:36:58 PM12/21/13
to mongoos...@googlegroups.com
Well he and I apparently used the links to download the files. You should update the links.

I already switched to lighttpd because it was "too much work" to get mongoose working.

Sergey Lyubka

unread,
Dec 21, 2013, 4:40:04 PM12/21/13
to mongoose-users
On Sat, Dec 21, 2013 at 9:36 PM, Jason <jaso...@gmail.com> wrote:
Well he and I apparently used the links to download the files. You should update the links.
I already switched to lighttpd because it was "too much work" to get mongoose working.

No worries, Jason.
Thanks for letting me know.

 
On Saturday, December 21, 2013 3:56:02 PM UTC-5, Sergey Lyubka wrote:
If you checkout mongoose and do it the top directory
cc mongoose.c build/main.c -I.
That will work without errors or warnings. build/main.c is the only main.c file
in the repository.

Please make sure your repo is in sync.

--
Reply all
Reply to author
Forward
0 new messages