Hey guys..I'm setting up redhat 9 or mandrake 9 tonight on this old pentium 1 133mhz...How do you compile c/c++ compilers...I know how to type them in the VI editor but then what do I do from the terminal??
Printable View
Hey guys..I'm setting up redhat 9 or mandrake 9 tonight on this old pentium 1 133mhz...How do you compile c/c++ compilers...I know how to type them in the VI editor but then what do I do from the terminal??
It depends on what compiler you have. Linux will probably come with GCC equipped, so you can simply do this to compile and run a program you've written:
Note that you have to be in the same directory as the .c file.Code:$ gcc prog.c
$ ./a.out
How will I run it though after compiling?
>How will I run it though after compiling?
./a.out
>How will I run it though after compiling?
Did you do everything I suggested? :) If you did then it would compile and run for you.
I always do
ggdb and Wall are just precautions and -o prog is for when you want to keep your executable after your next compile. If you keep the a.out, it'll be overwritten next time you compile a programme.Code:gcc -ggdb -Wall prog.c -o prog
and you run it :
$ ./prog
>ggdb and Wall are just precautions
It never hurts to throw -ansi and -pedantic in there too. ;)
>gcc -ggdb -Wall prog.c -o prog
I think that's just a little complex for someone who just started using the compiler and isn't likely to be using gdb just yet, or able to follow the mass of warnings that will probably appear, but good advice nonetheless.
It does if you are using ANSI unsupported functions ;)Quote:
It never hurts to throw -ansi and -pedantic in there too.
>It does if you are using ANSI unsupported functions
I considered mentioning that, but it wouldn't have sounded as good as a rule of thumb. :D And anybody who's anybody[1] only writes strictly conforming programs. :p
[1] Which would pretty much be nobody.
I always throw in -Wall to turn on all warnings.
I would also recommend throwing in -Werror
I have yet to see a warning from gcc or g++ that wasn't worth looking at.
I'm curious to know how well it runs on a 133. What WM are you using? I have redhat 9 on a 366 mhz machine running gnome and there is some noticable slowness.Quote:
Originally Posted by hern
>I'm curious to know how well it runs on a 133.
With KDE or GNOME, probably not well. With something less sophisticated like twm, it'll probably be pretty zippy. :)
twm is a bit on the gross side. I can tolerate something like CDE (although the first thing I do to all Solaris boxes is install gnome).
I guess I'm a spoiled windows guy still. Yes, I do most of my work at the command line now, but there's just something about working in a reasonable window manager. Half the time I just remote stuff to a windows X server anyway so I guess it is moot.
time to push fluxbox. I love it Small and fast; I can control keyboard functions(including: windows key...) and multiple desktops.
Although, I swapped to it from enlightenment. I am still waiting for their release of DR17. Those coders are lazier than most people here. It has been about 2 years. :mad: