Jump to content


compiling c code

  • Please log in to reply
1 reply to this topic

#1 John Cold

John Cold


  • Members
  • 3 posts

Posted 09 February 2005 - 08:55 AM

greetings commrades,

is there anybody who understands how to compile code using the gcc compiler built in to fc1. i assumed that the compiler itself had to be added from the cd so ofcourse i tried to add it...but, low and behold an error ocurred while trying to install one of the rpm packages and i have no idea what packages i do and dont need(theres a load of em as u know). if anybody could even vaguely run me thru the steps of setting up and using the gcc compiler, i'd appreciate it


#2 BSchindler



  • Members
  • 68 posts

Posted 14 February 2005 - 12:21 PM

If you are new to Linux, I suggest you install everything. Barring that, rerun the install and perform an update. You will see development tools ... add them. As RC uses a RPM system for installation, the installer will resolve the dependencies for you.

Now to compile a program. Open a terminal window. I suggest that you then set yourself up with a place to experiment:

name>mkdir source (a place where you will put source)
name>cd source
source>mkdir firsttest (your first project)
source>cd firsttest
firsttest>touch program1.c (your first program, for example)
firsttest>gedit program1.c (good editor - knows c and hilights)

*** Put a simple program in like the famous ...

#include <stdio.h>

printf("Hello World, this is my first compilation");

*** Save the file and exit

firsttest> gcc -o program1 program1.c (This will compile / link)
firsttest>./program1 (Well, you know what you will see)

Thats all there is to it. You can type gcc --help to see a list of what the compiler switches are. Note, this is a very simple example and will help you determine if you got all the compiler stuff loaded.

I strongly urge you to let the installer do the install for you. There are really a number of packages you need and it would be very frustrating to try to do it piecemeal if you are not familiar with the Linux programming environment.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

IPB Skin By Virteq