coolaj86 / libev-examples Goto Github PK
View Code? Open in Web Editor NEWA nice place for simple libev examples. Please contribute.
License: MIT License
A nice place for simple libev examples. Please contribute.
License: MIT License
stephan@ludo:~/cvs/libev-examples$ make
...
cc -Wall -Werror -lev -ggdb3 -I./include -o bin/unix-echo-client src/unix-echo-client.c
cc1: warnings being treated as errors
src/unix-echo-client.c: In function 'stdin_cb':
src/unix-echo-client.c:70: error: passing argument 2 of 'getline' from incompatible pointer type
/usr/include/stdio.h:671: note: expected 'size_t * __restrict__' but argument is of type 'uint *'
make: *** [bin/unix-echo-client] Error 1
Changing unix-echo-client.c:
uint len = 0;
to:
size_t len = 0;
corrects the problem.
(BTW: thanks for turning on -Wall and -Werror: more projects should do that by default!)
PS: gcc 4.4.5 on Ubuntu 10.10 on x86/64.
Thanks for creating the examples. There is a unix-echo-client.c, wonder if there is a tcp socket based echo client?
Thanks
https://github.com/coolaj86/libev-examples/blob/master/src/unix-echo-server.c#L64-L67
In this case, send() call does not always guarantee to send "n" bytes because cliend->fd is non-blocking mode.
So keeping the buffer (str[]) is needed until all buffer contents are flushed out.
The website linked in the readme is not reachable: "We can’t connect to the server at git.daplie.com"
Just cloned on ubuntu 14.04 with the default libev.
This is the #1 google result for "libev examples" - it would be nice if it worked with the most common developer distribution.
brian@ubuntu1404-vm:/dev/libev-examples$ make/dev/libev-examples$
cc -Wall -Werror -lev -ggdb3 -I./include -o obj/array-heap.o -c src/array-heap.c
cc -Wall -Werror -lev -ggdb3 -I./include -o bin/unix-echo-server src/unix-echo-server.c obj/array-heap.o
/tmp/ccDrpTcP.o: In function ev_loop': /usr/include/ev.h:826: undefined reference to
ev_run'
/tmp/ccDrpTcP.o: In function client_cb': /home/brian/dev/libev-examples/src/unix-echo-server.c:53: undefined reference to
ev_io_stop'
/tmp/ccDrpTcP.o: In function server_cb': /home/brian/dev/libev-examples/src/unix-echo-server.c:110: undefined reference to
ev_io_start'
/tmp/ccDrpTcP.o: In function main': /home/brian/dev/libev-examples/src/unix-echo-server.c:173: undefined reference to
ev_default_loop'
/home/brian/dev/libev-examples/src/unix-echo-server.c:180: undefined reference to ev_periodic_start' /home/brian/dev/libev-examples/src/unix-echo-server.c:184: undefined reference to
ev_io_start'
collect2: error: ld returned 1 exit status
make: *** [bin/unix-echo-server] Error 1
brian@ubuntu1404-vm:
Some version of gcc will ignore the linked Libraries if the -l options before the object files:
$ cc -Wall -Werror -lev -ggdb3 -I./include -o bin/unix-echo-server src/unix-echo-server.c obj/array-heap.o
ccVwfl0g.o: In function `ev_loop':
/usr/include/ev.h:826: undefined reference to `ev_run'
It is OK after moving the -lev
to the end of the command:
$ cc -Wall -Werror -ggdb3 -I./include -o bin/unix-echo-server src/unix-echo-server.c obj/array-heap.o -lev
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.