|Physics and Astronomy||
|Physics Home||Study here||Our Teaching||Our Research||Our Centres||News||Work here||EMPS|
Back to top
Compiling and debugging under Linux
ContentsEmacs or nedit to edit their program files and a program called make to handle compilation.
Compilation is handled by creating a control file, traditionally called 'Makefile', listing the source files, compiler options and the exact circumstances under which programs should be recompiled. Typing 'make' at the command line then recompiles all the files that have changed since the last compilation thus avoiding recompiling every single file every single time whether it needs it or not. You may also run make from within Emacs or nedit which has the advantage that the editor will warn you about any unsaved changes to your C files. Basically, the makefile is the equivalent of the 'project' in XCode or other Integrated Development Environments (IDEs).
We've created a simple example (basically the world's worst "Hello, world" program) for you to download.
As mentioned above, Linux and Mac OS X share the same debugger (gdb). On the Mac, gdb has a user-friendly front-end inside XCode. On Linux you can run gdb from inside of Emacs (they were originally written by the same person) but it is probably easier to use one of the available front-ends: