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??
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
My best code is written with the delete key.
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.
My best code is written with the delete key.
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
Last edited by Cikotic; 06-28-2004 at 07:02 PM.
If pointers have made you suicidal, you're not alone. But there is no need to hurt yourself. There are people who are willing to help. Just call your local C Crisis Centre and talk to the professtionals there. If you don't have a C3 in your neighborhood, go to the global C3 at www.cprogramming.com . If you're still suicidal, don't lose hope. Gently close your book on C and throw it in the fireplace. If you live in a tower, you can throw it out the window. There, doesn't that feel better?
>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.
My best code is written with the delete key.
It does if you are using ANSI unsupported functionsIt 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. And anybody who's anybody[1] only writes strictly conforming programs.
[1] Which would pretty much be nobody.
My best code is written with the delete key.
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.Originally Posted by hern
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
>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.
My best code is written with the delete key.
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.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
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.