notepad++ Configuring the C + + compilation Environment

Source: Internet
Author: User



It is easier to use this method if you are just testing the applet, if the professional IDE is recommended for large programs.



Often you need to write small programs to run, and you don't want to run an environment like Visual Studio, Eclipse, and notepad++ is a good choice, here's how to configure the C, C + + compilation environment in notepad++.



For ease of programming, open notepad--> Settings--Preferences ...--> backup and auto-completion,



Tick all inputs to enable auto-completion (select function autocomplete or Word auto-completion, depending on your preferences),



Tick input to prompt for function parameters.



First remind everyone, before running the command, remember to save the modified file.


I. Configuring C, c + + compilation Environment


This is a straightforward use of Visual Studio compilers and, of course, other compilers, such as GCC, that are similar in principle.



1. Setting Environment variables



This step is typically done automatically after Visual Studio is installed and does not require manual configuration.



Add user environment variables include, LIB, modify the user's path:



In the command line execute the following command, replace (program Files) with your directory, for example, my is C:\Program Files (x86). The version of Visual Studio that I installed on my computer is 10.0. Note whether the original path variable has a semicolon at the end.

Of course, you can also go to the advanced environment variables, System properties, and settings.



2. Adjust the files required by the compiler



Under (program Files) \microsoft Visual Studio 10.0\common7\ide\ directory,



Two files found "Mspdb100.dll" and "Mspdbsrv.exe",



Copy to (program Files) \microsoft Visual Studio 10.0\vc\bin.



3. Add Run options for notepad++



In notepad++, select Run ...



In the Input program name text box, enter the following three commands (the following three commands respectively debug, compile, run), click Save ..., and select the shortcut key, the name can be set to "C + + compilation" and so on (after saving will be displayed under the Run menu):


cmd /k chdir /d "$(CURRENT_DIRECTORY)" & cl "$(FILE_NAME)" & echo Running: & "$(NAME_PART).exe" & PAUSE & EXIT

cmd /k chdir /d "$(CURRENT_DIRECTORY)" & cl "$(FILE_NAME)" & PAUSE & EXIT 

cmd /k chdir /d "$(CURRENT_DIRECTORY)" & echo Running: & "$(NAME_PART).exe" & PAUSE & EXIT





At this point, you are done. You can write a code to try. Note that the suffix of the code file must be C or CPP, otherwise the VC compiler will not recognize it. Example:


 
#include<iostream> using namespace std; int main()
{ 

     cout<<"Hello, C++ world in Notepad++~"<<endl; return 1;  

}


4. MinGW and notepad++ to build, development environment. Here is the configuration for the notepad++:



To add an environment variable for MINGW first:
You need to add the following three paths, which are added to path (note separated by semicolons):
C:/Program Files/mingw/bin; C:/Program Files/mingw/include; C:/Program Files/mingw/lib;
To test whether the MinGW is configured successfully, command line input:
g++-O hello.exe hello.cpp
There is no error stating that the configuration was successful.



Another is to put MinGW into the notepad++, very simple, in the "Run" menu to add 3 buttons on it:


Compile cmd /k ...\MinGW\bin\g++.exe -g -W -Wall -o$(CURRENT_DIRECTORY)\$(NAME_PART).exe$(FULL_CURRENT_PATH) & PAUSE & EXIT
     Run cmd /k $(CURRENT_DIRECTORY)\$(NAME_PART).exe & pause &exit
     Debug cmd /k ...\MinGW\bin\gdb.exe $(CURRENT_DIRECTORY)\$(NAME_PART).exe 


In this way, after writing the code can not open the CMD Direct point button compile and run, which is also the most basic.



Tip: notepad++ 's Theme setting recommendations:


Obsidian Obsidian Theme +consolas No. 11th font


In fact, in the programming interface font settings basically the font size is 10, 11, 12 of these three font sizes.



The font is also mainly three kinds: Consolas, courier New, Verdana.






Reference article: http://blog.csdn.net/freewaywalker/article/details/8005468, see Java, Python configuration.



notepad++ Configuring the C + + compilation Environment


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.