Linux and C programming?
Why is it so difficult for me to install a C program language to do my programming? For example, when I tried to install Eclipse, it said my system does not have rpm. But when I tried to install rpm, the system said it is not available.
Perhaps can someone kindly tell me step by step how do I install a C programming language?
Thanks in advance.
I am only a novice.
Thanks for all the answers so far. I am currently using Ubuntu 7.04 Linux.
Tagged with: c program • c programming language • eclipse • Linux • novice • program language • rpm • thanks in advance
Filed under: rpm
Like this post? Subscribe to my RSS feed and get loads more!
To add my 2 cents: you should install a gcc compiler. Eclipse is quite a complicated programming environment to start with.
I think it should be quite easy to install gcc. Some distributions ask you at Linux install time about the packages you want installed…
there are 2 main camps on Linux distros — Debian-based and rpm-based. Fedora and its derivatives use the latter. Ubuntu and Debian use the former. So, to start any answer you will have to tell the world what distro of Linux you are flying.
Since you are saying that rpm is not installed in your system, most probably it must be a Debian based system. So, you type the following command to install in Debian:
sudo apt-get install eclipse
But, Eclipse is just an IDE (Integrated Development Environment) used to edit the source code in an easy manner, but it actually depends on the compiler to compile your program. So, if you really want to work with C Language in Linux, you don’t actually need Eclipse. Just check if gcc (GNU C Compiler) is installed on your machine or not, by just typing gcc at the prompt. If it shows you:
gcc: no input files,
then it means it’s already installed and you can compile C programs. Otherwise, you install gcc the same way as I said above.
sudo apt-get install gcc
If you also need C++, then install g++
sudo apt-get install g++
To compile a C program with gcc and execute it, type:
gcc -o execname sourcename.c
where execname is the name of the output executable file you’d like to get and sourcename.c is the name of the C source program file.
Now, to execute the compiled program, just type:
./execname
And you’ll see the output. Don’t forget to place .(dot) before /(slash) while executing. If it’s Ubuntu, everything I’ve said are already installed (not Eclipse, but gcc and g++ I’m saying). To edit your source file, use an editor like gedit or pico