一 安裝MinGW:
首先去官網下載下傳一個安裝器mingw-get-inst-20120426,下載下傳後隻是個安裝器,需要線上下載下傳真正的安裝内容,是以速度不會快。具體步驟如下:
1、選擇安裝版本(Repository Catalogues)
有兩個選擇,一個是目前打包版本,另一個是下載下傳最新版本。隻要你的安裝器是從官方下載下傳的,選擇前者即可,結果一般就是最新版本。
2、設定安裝目錄 預設安裝到C:\MinGW
3、選擇安裝元件
這個根據大家需要選擇安裝元件(C編譯器、C++編譯器、Fortran編譯器、ObjC編譯器、Ada編譯器等),一般選擇C/C++編譯器即可,看各位用途确定,元件清單中還有MSYS小系統等可供選擇。(簡單應用隻選C/C++ 編譯器就行)
4、等待下載下傳并安裝完成
5、設定MinGW環境變量
依次滑鼠點選桌面“我的電腦”->選擇左側的“進階系統設定”,選擇“進階”->“環境變量”,然後再Path裡增加;C:\MinGW\bin聲明。點選确定。(環境變量一般重新開機後生效)。
另外注意,一般添加上面一個path就可以了,若不行,可以添加下面詳細配置:(4.5.4是MinGW目前版本)
path 添加 C:\MinGW\bin;C:\MinGW\libexec\gcc\mingw32\4.5.2;C:\MinGW\mingw32\bin
include 添加 C:\MinGW\include;C:\MinGW\lib\gcc\mingw32\4.5.2\include
lib 添加 C:\MinGW\lib;
6. 重新開機後,簡單測試:
① cmd輸入Gcc -v檢視Gcc 版本資訊 正确如下:

② 編譯運作C 程式
text.cpp
#include <stdio.h>
int main() {
printf("Hello World!");
return 0;
}
編譯指令:g++ test.cpp -o test
輸出結果為:test.exe
cmd下運作程式:輸出Hello World! 安裝設定正确
二、 不利用下面的插件NppExec來添加編譯運作指令:
①"Run"-> "Run..." 代開對話框如下:cmd /k "g++ $(FULL_CURRENT_PATH) -o $(CURRENT_DIRECTORY)\$(NAME_PART) "& PAUSE & EXIT,然後Svae為ComplieCpp,運作即可編譯。
②“Run” -> "Run...", 打開對話框如下,輸入cmd /k "$(CURRENT_DIRECTORY)\$(NAME_PART).exe" & PAUSE & EXIT ,然後Save為RunCppExe運作,
③在Menu->"Run“下來菜單下,可以看到ComplieCpp和RunCppExe選項
三、NotePad++ Plugins
注意自己的NotePad++ 應該也是Unicode版
google搜 notepad plugins 可以找到這兩個軟體的最新版下載下傳即可
1、Function List ( Unicode )
目前最新版本:Version 2.1
釋出日期:2010-02-18
2、NppExec ( Unicode )
目前最新版本:Version 0.4.1
釋出日期:2010-07-22
3. 安裝說明
如何安裝NotePad++的插件,其官網原文如下:
Usually, the only installation procedure plugins require is to
place the dll in the plugins subfolder of the Notepad++ install folder;
place any configuration file it comes with in plugin\config
preferrably, place all documentation files in plugin\doc, or in some subfolder of it
Notepad++ loads plugins at startup. To load a new plugin, you can either close and restart Notepad++, or use the Settings -> Import -> Import plugin command. The latter will copy the dll in the plugin folder if it is not already there.
譯文:
通常情況下,安裝程式插件隻需要執行如下方法:
将DLL檔案複制到Notepad++安裝目錄的plugins目錄下;
将配置檔案複制到plugins\Config目錄下;
更好的做法,将所有的文檔檔案複制到plugins\doc目錄下,或它的子目錄下。
Notepad++在啟動的時候載入插件。要載入一個新插件,你可以關閉并重新開機Notepad++,或使用 Setting -> Import -> Import plugin 指令。稍後将複制插件的DLL到plugins目錄下。
一般下載下傳一個插件,裡面都有其install.txt 可以檢視
4. FunctionList 安裝
Function list 2.1 hangs (up to "50%" indicated) with VHDL and crashes when selecting other language.
Function List 2.01 crashes, npp (from 5.8 to 6.3.2) doesn't launch.
插件好久不更新了,好像有問題,安裝不成功。附加一個文章:
http://blog.sina.com.cn/s/blog_53d27b3a0101bmqz.html
In Windows Vista:-
Copy FunctionList.dll in C:\Program Files\Notepad++\plugins-
Copy C++.flb and Gmod Lua.bmp in C:\Program Files\Notepad++\plugins\Config-
Copy FunctionListRules.xml in C:\Users\USERNAME\AppData\Roaming\Notepad++\plugins\config
下面中文方法不采用
1>、下載下傳并解壓 FunctionList_2_1_UNI_dll.zip。
2>、将 FunctionList.dll 複制到Notepad++ 的 plugins 目錄下。
3>、将C++.flb、FunctionListRules.xml、Gmod Lua.bmp 複制到 plugins\Config 目錄下。
4>、重新開機NotePad++。
5. NppExec插件安裝和配置 / Howto Install and Configure Plugin "NppExec"
1、NppExec安裝。
下載下傳并解壓 NppExec_041_dll_Unicode.zip。
将 NppExec.dll 和目錄NppExec 複制到Notepad++ 的 plugins 目錄下。
将doc目錄下的 fparser.html、NppExec.txt、NppExec_Manual.chm、NppExec_Manual.knt、NppExec_TechInfo.txt 複制到 plugins\doc\NppExec 目錄下。
重新開機NotePad++。
2、NppExec配置。
1. Menu -> Plugins -> NppExec -> Execute...。
打開Execute...對話框
2. 配置編譯C檔案。
進入“Execute...” 對話框,輸入 cmd /c "gcc $(FULL_CURRENT_PATH) -o $(CURRENT_DIRECTORY)\$(NAME_PART) ",點選“Save...”按鈕儲存,命名為“CompileC”。
![]()
MinGW 安裝 及 NotePad++配置C/C ++環境 插件安裝一 安裝MinGW:二、 不利用下面的插件NppExec來添加編譯運作指令:三、NotePad++ Plugins 四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion 注:
運作下方,點選儲存成常用運作指令,并可設定快捷鍵
$(NAME_PART) :目前操作檔案的檔案名,不含字尾
$(FULL_CURRENT_PATH) :目前操作檔案的完整路徑,包括盤符、路徑、檔案名、字尾
& PAUSE :運作後暫停等待鍵盤操作
& EXIT :完成後退出運作視窗,回到notepad++
GCC :C語言編譯器
G++ : C++語言編譯器
![]()
MinGW 安裝 及 NotePad++配置C/C ++環境 插件安裝一 安裝MinGW:二、 不利用下面的插件NppExec來添加編譯運作指令:三、NotePad++ Plugins 四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion 3. 配置編譯C++檔案。
進入“Execute...” 對話框,輸入 cmd /c "g++ $(FULL_CURRENT_PATH) -o $(CURRENT_DIRECTORY)\$(NAME_PART) ",點選“Save...”按鈕儲存,命名為“CompileC++”。
![]()
MinGW 安裝 及 NotePad++配置C/C ++環境 插件安裝一 安裝MinGW:二、 不利用下面的插件NppExec來添加編譯運作指令:三、NotePad++ Plugins 四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion 4、 運作C/C ++ 目前編譯後的*.exe程式![]()
MinGW 安裝 及 NotePad++配置C/C ++環境 插件安裝一 安裝MinGW:二、 不利用下面的插件NppExec來添加編譯運作指令:三、NotePad++ Plugins 四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion
進入“Execute...” 對話框,輸入cmd /c "$(CURRENT_DIRECTORY)\$(NAME_PART).exe" ,點選“Save...”按鈕儲存,命名為“RunProgram” (名字自定)。![]()
MinGW 安裝 及 NotePad++配置C/C ++環境 插件安裝一 安裝MinGW:二、 不利用下面的插件NppExec來添加編譯運作指令:三、NotePad++ Plugins 四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion ![]()
MinGW 安裝 及 NotePad++配置C/C ++環境 插件安裝一 安裝MinGW:二、 不利用下面的插件NppExec來添加編譯運作指令:三、NotePad++ Plugins 四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion 5、将“CompileC”,“CompileC++”,“RunProgram” 添加到宏菜單(Macros)下并添加快捷鍵。
1)打開菜單 Plugins -> NppExec ->Advanced Options...
2)在Associated script:下面下拉框中選擇“CompileC”,“CompileC++”,點選“Add/Modify”按鈕将它們依次添加到Menu items下面的清單中。
選擇 "Place to the Macros submenu"複選框。
![]()
MinGW 安裝 及 NotePad++配置C/C ++環境 插件安裝一 安裝MinGW:二、 不利用下面的插件NppExec來添加編譯運作指令:三、NotePad++ Plugins 四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion ![]()
MinGW 安裝 及 NotePad++配置C/C ++環境 插件安裝一 安裝MinGW:二、 不利用下面的插件NppExec來添加編譯運作指令:三、NotePad++ Plugins 四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion 3)打開菜單 Macro ,可以看到“CompileC”,“CompileC++” "RunProgram"都已經添加到宏菜單(Macros)下。
注意:在編譯運作的程式中,路名名稱内不要含有空格
4) 添加指令快捷鍵:
- Go to Menu Settings -> Shortcut mappter -> Plugins -> search for the script name
- Select the shortcut to use (ie ctrl + F9/F10), click ok (note: It cannot work when I set ctrl+1/2/3, Why? )
- Verify that you can now run the script created with the shortcut selected.
四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion
1、打開菜單 Settings -> Preferences...。
2、點選 Backup/Auto-Completion 頁籤。
選擇 Enable auto-completion on each input.
選擇 World completion。
選擇 Function parameters hint on input
3、在編輯區域中,輸入内容,自動聯想提示功能效果如下圖所示。
![]()
MinGW 安裝 及 NotePad++配置C/C ++環境 插件安裝一 安裝MinGW:二、 不利用下面的插件NppExec來添加編譯運作指令:三、NotePad++ Plugins 四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion 原文參考資料: 1. http://aofengblog.blog.163.com/blog/static/63170212010111164752194 2. http://www.metsky.com/archives/588.html 注明:本文因參考資料配置未能成功,參考網上一些資料,整理出來,以備後用。![]()
MinGW 安裝 及 NotePad++配置C/C ++環境 插件安裝一 安裝MinGW:二、 不利用下面的插件NppExec來添加編譯運作指令:三、NotePad++ Plugins 四、NotePad++ 開啟自動聯想提示 / NotePad++ - Enable Autocompletion