coolaj86 / libev-examples

A nice place for simple libev examples. Please contribute.
MIT License
236 stars 84 forks source link

The order of LDFLAGS for gcc #5

Open hmgle opened 9 years ago

hmgle commented 9 years ago

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
zztczcx commented 9 years ago

I meet the same problem