hello people.
how are you all doing?
my problem is i have been programming in c++ for almost a year now but i have always used windows with microsoft visual studio and dev c++ but now i discovered that programming in ubuntu is much more fun couz it is way faster than windows.... now the problem is i dont know which compiler i should use... i have never programmed anything in ubuntu apart from a php website that i built 2 month ago...
please help me to solve this problem..
all i need is the compilers i need and where i can get them from..
thats all!
any help will be greatly apreciated!!

Recommended Answers

All 2 Replies

The compiler is GCC (for all Linux distros).

With Ubuntu, you can simply run this in the terminal:

$ sudo apt-get install build-essential

(the dollar sign is just to represent the start of the command prompt in the terminal, you shouldn't type it)

The "build-essential" package will install GCC (for C, C++ at least) and all relevant tools (like "make").

GCC is obviously just a command-line compiler. It is not an IDE like Visual Studio, or Dev C++, that's a separate thing, i.e., Visual Studio is an IDE that uses the Microsoft compiler (or MSVC for short), and Dev C++ is an IDE that uses the GCC port for Windows (with MinGW).

With GCC installed, you can compile a simple C++ program by going to its directory (via the terminal) and typing this (for "foo.cpp" for example):

$ g++ -Wall foo.cpp -o foo

And that's it.

Now, if you want an IDE to work with, then you have quite a few to choose from. Some Linux purists would say that "emacs" is the only thing you need (just an enhanced text-editor, with syntax highlighting and stuff). More reasonably, I could recommend three that seem prevalent, Qt Creator (package: "qtcreator"), CodeBlocks (package: "codeblocks") or KDevelop (package: "kdevelop"). They can all be installed from apt-get or through your synaptic (or package manager).

Hey... Thanks a lot for the help... This helped a lot... Thanks again!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.