1

I am running notepad++ through wine. But I am not able to compile a program(specially c++).

Is there any compiler that I could use? What should I do?

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83

2 Answers2

6
  1. Install g++ sudo apt-get install g++.
  2. Open terminal and go to file directory.
  3. Fast compiling g++ filename.cpp and run ./a.out.enter image description here
  4. Specify output name g++ filename.cpp -o filename.out.
  5. If you want to know more about g++ open terminal and write man g++.
Mohamed Slama
  • 1,849
  • 1
  • 17
  • 37
  • thnx..but i need some different compiler ...i dont want to use terminal on compiling – Nitin Agrawal Jun 22 '16 at 04:45
  • 1
    it's not terminal the compiler now is g++ which is the most used by c++ programmer if you asking for install another tool or IDE install geany, codeblocks , eclipse or netbeans – Mohamed Slama Jun 22 '16 at 04:47
  • 1
    Runs Linux, doesn't want to use a terminal... You could learn how to write makefiles, that would prevent you having to write the compiler options over and over. Though you would still have to invoke make... – Baldrickk Jun 22 '16 at 08:01
4

Notepad++ is not a compiler and does not contain a compiler. You must install a separate compiler, then configure Notepad++ to use it.

The NppExec plugin (docs) can be made to do this. (I've never done it, so I cannot verify that the following currently works.) This answer over on stackoverflow gives detailed instructions to use NppExec to save the current document, and then run it through a perl interpreter. The (currently) other answer here gives an example of passing the source through the g++ compiler (for C++).

Just to be clear: There is no compiler bundled with Notepad++. You must install another package to have a compiler. Once you have done so, you can adapt the above to cause Notepad++ to save your source, invoke the compiler on the source, run the resulting executable (which you might eventually want to make condition on a successful build), and show you its console output.

If you would prefer a complete IDE (instead of a very fancy editor that can be made into an IDE), see this other question and its several answers. Note that these also require installation of a compiler (as a separate package). Some of these include this requirement via package dependencies, but generally do not -- you will still have to install a compiler. I might go with the invocation

sudo apt-get install build-essential

since this will include g++, gcc, libc*-dev, and make. (Package build-essential is intended for building Debian packages, but includes a bare minimum C++ build chain.)