Jump to content
Compatible Support Forums
Sign in to follow this  
John Cold

compiling c code

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×