Sunday, April 22, 2012

First SDL program on Linux.

All it does is open a window that says Hello World.

https://github.com/BuckRogers1965/SDLtut/blob/master/first.c

You compile this program by typying:

gcc `sdl-config --cflags --libs` first.c

Then run the a.out program by typing:

./a.out

https://github.com/BuckRogers1965/SDLtut/blob/master/first++.c

I had to use a c extension on this c++ program because wordpress is retarded.

 You compile this program by typying:

g++ `sdl-config --cflags --libs` first++.c

Then run the a.out program by typing:

./a.out

The only difference between the two is that the c++ version uses the bool, true and false keywords, while the c version uses int
and then defines TRUE and FALSE.

I got the original example code from here.

Interestingly the code is .2KB bigger when compiled as C++.

No comments:

Post a Comment