hello there. i've installed mingw compiler and im wondering how i would go about setting up notepad++ to compile my c/c++ code?. How do i do this?

-regards.

Recommended Answers

All 15 Replies

hello there. i've installed mingw compiler and im wondering how i would go about setting up notepad++ to compile my c/c++ code?. How do i do this?

-regards.

I assume that the g++ command is in your PATH and that your environment variables are set correctly.

Then follow these steps:

  • Create a simple batch file called compile.bat which contains the following:
    g++ -o %1 %2
    PAUSE
  • Save it in the same directory as your C++ source file.
  • In Notepad++, you open the Plugins menu > NppExec > Follow $(CURRENT_DIRECTORY)
    (or you just press F5), a little dialog pops up, click the ... button and browse to the directory where your source file (and thus your batchfile) is in, select the batchfile (compile.bat) and click on Open, the path to your batchfile is now added to that textbox, now you have to put quotes (") around it, a little example:

    Let's say that the path to your batch file is: C:\compile.bat , then after putting quotes around it it becomes [B]"[/B]C:\compile.bat[B]"[/B] , after that you type the name you want to give to your executable file, for instance myprogram.exe, and thereafter (seperate those two with a space) you type the name of your C++ source file, for example: mysrc.cpp, the whole line would then be:

  • [B]"C:\compile.bat" [I]myprogram.exe[/I] [I]mysrc.cpp[/I][/B]

Hope this helps :)

Why would you want to do that? Just use Code::Blocks and you have it done, and probably much better too. And Code::Blocks contains a debugger, which Notepad++ does not.

hmm...i was hoping to just edit text files without getting into major IDE's.

Member Avatar for jencas

Some people use to eat their soup with a fork.......

commented: LOL :) +36

please how do i use notepad to compile my c++ codes with codeblocks

You don't. Notepad is just a text editor, not a compiler. Code::Blocks is distributed with a greate compiler. when you download CB get the distribution that contains MinGW compiler.

Thanks but how do i use the run option in notepad++ when writing c++ codes

What did the NotePad's HELP say about the RUN option.

. . . Code::Blocks is distributed with a greate compiler. when you download CB get the distribution that contains MinGW compiler.

Not to hijack the thread (though the OP hasn't posted here since 2009), but I am presently looking around for a free C++ IDE/compiler myself. Would you recommend Code::Blocks over Visual C++ 2010 Express, or even something else?

@capton: If you are using Code::Blocks why would you want to use Notepad++? Doesn't make any sense.

Not to hijack the thread (though the OP hasn't posted here since 2009), but I am presently looking around for a free C++ IDE/compiler myself. Would you recommend Code::Blocks over Visual C++ 2010 Express, or even something else?

Use Code::Blocks if you want to write portable programs -- its supported on MS-Windows, *nix and MAC. VC++ 2010 is only for MS-Windows, but is the easiest to write MS-Windows programs with any or a combination of several .net languages.

Ok. thanks
just thought i could compile with codeblocks on notepad++

Code::Blocks is not a compiler, its an IDE very much like notepad++.

FWIW the Zeus Lite editor can run an external compiler and capture the compiler error output.

http://www.zeusedit.com/lite/

Just edit the c/c++ document type and add the compiler command line to the compiler panel.

Be a part of the DaniWeb community

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