c compiler
i was wandering if there was any good c compilers that are free for linux?
|
mh, I think you should read more in the manuals for your system. Every Linux-distribution comes with gcc, most distributions install it by default.
Markus |
The standard compiler for Linux is GCC (it's free and open-source). It should be in pretty much every distro's package repository.
Quote:
|
Hello
@MTK358: thanks, maybe I was wrong. I helped archie101 in several threads here at LQ, he's using Arch and should not have any problems finding gcc (I don't indeed remember if it is installed by default ;) ). Markus |
Quote:
The package for all the development tools is called "base-devel". I'd recommend that the OP installs this instead of just GCC individually. |
I have it installed but i do not know how to open it up and write a program. i looked on archlinux.org and did not find out how to.
|
You will have to write a C-program with your favorite text-editor (i.e. vim ;) ) and then compile it
Code:
gcc -o myprogram myprogram.c Markus |
Write a simple c program. Then compile it using gcc -o <progname.o> <progname.c>.
You can also compile it straightaway with gcc <progname>. In this case the compiled binary name would be a.out. You can then execute the compiled binary using ./<progname.o> or ./<a.out>. Hope this helps. PS: AFAIK _all_ distros come with gcc - unless you specifically did not install it. You can check that with 'whereis gcc'. |
Quote:
|
i made a file put a simple c program in it saved it and ran gcc -o nameofmyprogram nameofmyprogram.c and it said gcc: error: hello.c: No such file or directory
gcc: fatal error: no input files compilation terminated |
if your program is hello.c, you should try
Code:
gcc -o hello hello.c |
and this is my program to anyone who knows c and might find an error with it:
#include <stdio.h> #include <conio.h> int main(void) { printf("hello"); getch(); } |
you should use code-tags for programtext in your posts.
If you delete the line #include <conio.h> and the getch() line it will compile and run. |
now it says hello.c:3:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
and how do i use code-tags? |
You may use the "Go Advanced" button at the bottom of your new post, then you end up in an advanced editor where there is this # character where you can click in order to wrap code-tags around the text.
You may as well use the "quote" button for any post where someone used code-tags and see how it works. Markus |
All times are GMT -5. The time now is 09:58 AM. |