[Techtalk] C in Linux
Kathryn Hogg
kjh at flyballdogs.com
Sun Dec 23 22:22:46 UTC 2007
Info Warrior wrote:
> I am trying to write some C programs with SuSe Linux 10.1. What would be
> the best interface to use? GNOME, X Terminal, or Konsole?
Whatever you prefer. Any of those will give you decent access to the
command line. FWIW, I use Gnome and like gnome-terminal better than
xterm.
> What are the
> programs I use to create, save, and compile the program?
Unless you're looking for a full blown IDE, you can edit files in any old
editor (emacs, vi, etc). The standard way of compiling programs is via
the make command. You'll probably need to edit a makefile to describe
your program (assuming its not a trivial program fully contained in a
single .c file and needs no system libraries other than the defaults).
For example,
1. fire up a terminal window
2. vi hello.c
3. Enter the following contents into the file
#include <stdio.h>
int main(int argc, char **argv)
{
printf("hello world!\n");
return 0;
}
:w!
4. In another terminal window
make hello
./hello
Since hello is a simple program (just one file and no extra libraries
needed), we don't need to create a makefile to describe how to build it.
Notice that I like to keep the open in the editor but save it (:w!) so
that I can compile and run it in a separate terminal.
I actually do things differently (use emacs to edit and invoke make by
running M-x compile in emacs)
--
Kathryn
http://womensfooty.com
More information about the Techtalk
mailing list