Configure the mingw command line in the notepad ++ (6.4.2) Environment

Source: Internet
Author: User

Install the latest version 6.4.2 of notepad ++, select "plug-in" -- "plugin manager" -- "show plugin manager", and select "nppexec" in available ", click Install.

Open a C program and use the F6 shortcut key to bring up the execute dialog box. Refer to the help document of notepad ++ and enter the command line in it:


//save current file 
NPP_SAVE 

  // run@.cpp
  SET gcc = C:\MinGW\bin\gcc.exe
  SET obj = $(CURRENT_DIRECTORY)$(NAME_PART)
  "$(gcc)" -c "$(FULL_CURRENT_PATH)" -o "$(obj).o"
  "$(gcc)" "$(obj).o" -o "$(obj).exe"
  npp_run "$(obj).exe"
  UNSET obj
  UNSET gcc



Set GCC = "Your mingw installation directory", and add a mingw system variable "C: \ mngw \ bin" to the system environment variable path. otherwise, a DLL missing error is reported, and the C program can be compiled correctly. If you want to compile the C ++ program, replace GCC with G ++.


Ultimate Edition:


//clear screen
cls

//save current file 
NPP_SAVE

// compile
SET gcc = D:\MinGW\bin\gcc.exe
SET obj = $(CURRENT_DIRECTORY)\$(NAME_PART)
cmd  /c   if exist  "$(obj).exe"   del "$(obj).exe"
"$(gcc)" -c "$(FULL_CURRENT_PATH)" -o "$(obj).o"
 cmd  /c   if exist  "$(obj).o"  "$(gcc)" "$(obj).o" -o "$(obj).exe"

//run
//npp_run "$(obj).exe"
cmd /c     if exist  "$(obj).o"  del  "$(obj).o" 
cmd /c     if exist  "$(obj).exe"  "$(obj).exe" 

 UNSET obj
 UNSET gcc


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.