Can I use a C/C++ compiler?

Ubuntu provides the standard Gnu Compiler Collection in the repositories.

You can install the Gnu C Compiler gcc Install gcc as well as the Gnu C++ compiler g++ Install g++ with the following command:

sudo apt-get install gcc g++

You'll probably also want to install libc6-dev Install libc6-dev (which includes the C standard library) and libstdc++6-4.5-dev Install libstdc++6-4.5-dev (which includes the standard C++ libraries).


If you're looking for something comparable to Microsoft's Visual C++ compiler, try taking a look at Qt - specifically Qt Creator Install qtcreator. It's a full-fledged IDE with a visual form designer, code-editor, and debugger.

enter image description here

enter image description here


Edit:
Now that it's clear what you mean by "perfectly as in Microsoft windows?", then Qt Creator (which I mentioned above) will be perfect for your needs. You won't need to use the console to compile your applications and the Qt framework is easy to learn and use.

There's a great tutorial for getting started with Qt here.


The below is (1) a simple hello-world program (2) compiled (3) made executable (4) executed. If you don't have the compiler, install gcc and g++ using the software install gui, or by running this command: sudo apt-get install gcc g++

jake@daedalus:~/playground$ cat hello.cc 
// 'Hello World!' program 

#include <iostream>

int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}
jake@daedalus:~/playground$ g++ hello.cc -o hello
jake@daedalus:~/playground$ chmod +x hello
jake@daedalus:~/playground$ ./hello 
Hello World!
jake@daedalus:~/playground$

You could install the c++ compiler via terminal.

sudo apt-get install build-essential

To write your code there a lot of editors like Gedit (installed by default) or Emacs. If you need an Integrated development environment, you could use Anjuta for example.

sudo apt-get install anjuta anjuta-extras

See: How to Compile a C/C++ Program on Ubuntu Linux

German list with IDEs

Tags:

Gcc