nathandemick.com

Tutorial: Use gcc/g++ with Cygwin

One of the problems that I always faced as a developer was what compiler to use on the Windows platform. While Linux-based operating systems come with their own compilers, Windows users are kinda screwed... I think the last tool that came with DOS/Windows and allowed you to make programs was QBasic. So the question is, what're some free tools I can use to make Windows binaries?

Enter Cygwin, a Linux-like interface for Windows. It has the bash shell, as well as lots of popular tools, such as C/C++ compilers. This is pretty much just what we want, eh?

Let's download and set up Cygwin. Hit up the website and click the "get Cygwin" link on the right. Run the installer, and make sure to have the 'developer tools' option checked during setup. When you're done with that, this readme has all the information you need regarding installing the SDL library. OpenGL libraries will be installed with Cygwin by default.

That's it! You're ready to rock. Just compile your SDL/OpenGL program using a command similar to this:

gcc -o test.exe main.c `sdl-config --cflags --libs` -lglu32 -lopengl32

If you're using SDL, make sure to have a copy of SDL.dll in the directory your program is in.

· 0 comments


Comments