compiling c code

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.

Everything Linux 1798 This topic was started by ,


data/avatar/default/avatar26.webp

3 Posts
Location -
Joined 2005-02-09
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
 
j.cold

Participate on our website and join the conversation

You have already an account on our website? Use the link below to login.
Login
Create a new user account. Registration is free and takes only a few seconds.
Register
This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


data/avatar/default/avatar39.webp

68 Posts
Location -
Joined 2005-01-24
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>
 
main(void)
{
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.
 
HTH