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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×