Nietzsche says "God is dead" God says "Nietzsche is dead "
Header image

Compile C C++ in linux

Posted by ALonon in Linux

i have studied c++ for my exam today and i will explain how can you compile c/c++ in linux also there were some error that i want mention.

1.install eclipse (not necessary for compiling)
probably you can find it from your package manager if there isn’t
use this link: http://www.eclipse.org
for pardus open pisi search for eclipse and install it ( 3.3)

2. install CDT plugin for eclipse
open eclipse help -> software updates -> avilable softwares -> add site
for eclipse 3.4 add this:

http://download.eclipse.org/tools/cdt/releases/ganymede

for eclipse 3.3 add this:

http://download.eclipse.org/tools/cdt/releases/europa

check it and click install

you have eclipse CDT to write your c and c++ codes
now you need gcc to compile it

3. install gcc
find gcc from your package manager.
for pardus write this to console
sudo pisi it gcc

4. first simple
i opened a new c++ project from eclipse, created new source file, writed my code and saved. when i am trying to make file,
I received this message “(Exec error:Cannot run make)” .

(solution: install make from your package manager.For pardus write this sudo pisi it make.)

after that i tried it on console with giving this command

(for c++ codes)

g++ example.cpp

(for c codes)

gcc example.c

however, i received “iostream.h: No such file or directory gcc”
solution: delete .h just write <iostream> also write g++ for *.cpp files

after i installed make, i was able to compile it from console and eclipse.

if you want to see your code’s output:

g++ example.cpp

it makes a compiled file named example in your folder

to run it just write

./example

i hope , help you.

Related posts

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

Leave a Reply