C weirdness

29 Jul 2012

Well, it's not that C is weird; it's just tough in general.

Today, I'm trying to implement a high-performance echo server.

I've read a lot of stuffs on the internet and found that using libevent is probably the best way to implement it.

I'm also struggling with configuring the Makefile.

On Ubuntu, the files and options must be in a certain order, otherwise your code wouldn't be compiled. For example,

cc -g -O2 -Wall -Wextra -Isrc -rdynamic -DNDEBUG bin/zeus.c build/lib_zeus.a /usr/lib/libevent.a -o bin/zeus -lrt

This works. But if you move `-lrt, it won't work. Or, if you move ``*.a` to come before*.c``, then it won't work.

What the fuck is wrong with the C-compiler, seriously?

I have spent like an hour figuring out how to shuffling the order of files in Makefile….

Give it a kudos