Wednesday, August 30, 2006

C and FORTRAN Compilation in Slackware Linux

So, you'd like to code in Slackware Linux? Here are some tips for using C and FORTRAN.

C
First, you create a source file (extension .c). You can use mcedit in your terminal. Just type

mcedit mycode.c

You can now start coding. Here is a simple example:

main (){
printf ("ok \n");
}

Press F10 and save your file
(mycode.c).

Now compile the program with gcc

gcc mycode.c -o mycode -O

Run the created binary with
./mycode


FORTRAN
First, you create a source file (extension .f). You can use mcedit in your terminal. Just type

mcedit mycode.f

You can now start coding. Here is a simple example:

program mycode
write(*,*) "OK"
end program

Press F10 and save your file
(mycode.f).

Now compile the program with g77

g77 mycode.f -o mycode -O

Run the created binary with
./mycode




That is it! I hope this is usefull for the beginer users! Have fun!






1 Comments:

Blogger Andrew Spa said...

Hey Cool! Just found this via a google search. I know this article is from back in 06 so I'm not sure if this blog is still in use, but I was wondering if the gnu compiler was updated to the Fortran 2008 standard? I'm not an expert programmer, but I am entering college as a computer science major next year, and programming languages in general interest me.

8:20 PM  

Post a Comment

<< Home