


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Ben Hermens - [email protected]
This tutorial intends to help you use gcc to compile your C code. I will also introduce makefiles to save you lots of typing. I will keep things as basic and brief as possible. If you need more help than is provided here, email or come to office hours. I am writing this tutorial for the RedHat Linux machines in the ENGR labs. I will grade your programs using those machines. You can develop your code wherever you want but before you submit it, make sure it will compile and run without errors or warnings using gcc as I describe below.
Right click on the desktop and select “Open Terminal”. You will be in your home directory. Here are a few basic commands for working in a terminal: Command and Arguments Description pwd Print the current directory path ls List files and directories in the current directory cd
With a new terminal open, follow these commands:
gcc is a command line compiler on Unix/Linux operating systems. The most basic use is as follows:
As I mentioned before, you can write your programs anywhere you want. You don't have to write them on the lab machines. Before you submit a program, you should compile and run it on the lab (linux) machines to make sure there aren't any surprises when you get your grade. You can access the lab machines from home using ssh. dear115-##.engr.oregonstate.edu or kec1130-##.engr.oregonstate.edu (where ## = 01, 02, ...) You can only get to these machines from within the campus network though so you'll probably have to ssh to flop.engr.oregonstate.edu and connect to the lab machine from there. If you're looking for a free C compiler to run at home, this website has a long list: http://www.thefreecountry.com/compilers/cpp.shtml My preference would be for Microsoft Visual C++ 2005 Express. You'll want to make sure the compiler is treating your files as C code and not C++ code. Many C/C++ compilers are capable of either and will likely default to C++.