導航:首頁 > 源碼編譯 > vimforwindows編譯

vimforwindows編譯

發布時間:2023-02-28 15:38:44

① vim 在windows 系統下怎麼編譯c++

如果只是使用C++編程,而不是使用windows的MFC編程,可以考慮安裝mingw編譯環境,可以編譯出在windows系統下的可執行程序。
mingw介紹http://ke..com/view/98554.htm
mingw網站http://www.mingw.org/
網上也可以搜索到許多mingw的安裝
http://www.cppblog.com/mymsdn/archive/2008/07/27/57290.html
安裝後可以在vim中執行
:!gcc -o a.exe file.cpp
編譯文件,
也可以編寫makefile文件執行:make編譯文件。
這時配合打開quickfix窗口可看到編譯信息。Quickfix打開方法:copen

② 如何在win7安裝vim編譯器

安裝gVim
1.
安裝時可以選擇更改目錄(文中在
Users/用戶名
下面新建了一個目錄Vim,將gVim安裝在了該目錄下)。
2.
安裝時注意選擇『Full』
option。
3.
在vimfiles
文件夾下,會有許多空文件夾。將它們全刪掉。
4.
將vim74文件夾下的「autoload」文件夾
剪切

vimfiles
文件夾下。
5.
在vimfiles
文件夾下
新建文件夾
bundle。

③ 我想在vim中直接編譯C語言請問怎樣配置vimrc啊

python">"------------------------------------------------------------------------------
" < 編譯、連接、運行配置 >
"------------------------------------------------------------------------------
" F9 一鍵保存、編譯、連接存並運行
map <F9> :call Run()<CR>
imap <F9> <ESC>:call Run()<CR>
" Ctrl + F9 一鍵保存並編譯
map <c-F9> :call Compile()<CR>
imap <c-F9> <ESC>:call Compile()<CR>
" Ctrl + F10 一鍵保存並連接
map <c-F10> :call Link()<CR>
imap <c-F10> <ESC>:call Link()<CR>
let s:LastShellReturn_C = 0
let s:LastShellReturn_L = 0
let s:ShowWarning = 1
let s:Obj_Extension = '.o'
let s:Exe_Extension = '.exe'
let s:Sou_Error = 0
let s:windows_CFlags = 'gcc -fexec-charset=gbk -Wall -g -O0 -c % -o %<.o'
let s:linux_CFlags = 'gcc -Wall -g -O0 -c % -o %<.o'
let s:windows_CPPFlags = 'g++ -fexec-charset=gbk -Wall -g -O0 -c % -o %<.o'
let s:linux_CPPFlags = 'g++ -Wall -g -O0 -c % -o %<.o'
func! Compile()
exe ":ccl"
exe ":update"
if expand("%:e") == "c" || expand("%:e") == "cpp" || expand("%:e") == "cxx"
let s:Sou_Error = 0
let s:LastShellReturn_C = 0
let Sou = expand("%:p")
let Obj = expand("%:p:r").s:Obj_Extension
let Obj_Name = expand("%:p:t:r").s:Obj_Extension
let v:statusmsg = ''
if !filereadable(Obj) || (filereadable(Obj) && (getftime(Obj) < getftime(Sou)))
redraw!
if expand("%:e") == "c"
if g:iswindows
exe ":setlocal makeprg=".s:windows_CFlags
else
exe ":setlocal makeprg=".s:linux_CFlags
endif
echohl WarningMsg | echo " compiling..."
silent make
elseif expand("%:e") == "cpp" || expand("%:e") == "cxx"
if g:iswindows
exe ":setlocal makeprg=".s:windows_CPPFlags
else
exe ":setlocal makeprg=".s:linux_CPPFlags
endif
echohl WarningMsg | echo " compiling..."
silent make
endif
redraw!
if v:shell_error != 0
let s:LastShellReturn_C = v:shell_error
endif
if g:iswindows
if s:LastShellReturn_C != 0
exe ":bo cope"
echohl WarningMsg | echo " compilation failed"
else
if s:ShowWarning
exe ":bo cw"
endif
echohl WarningMsg | echo " compilation successful"
endif
else
if empty(v:statusmsg)
echohl WarningMsg | echo " compilation successful"
else
exe ":bo cope"
endif
endif
else
echohl WarningMsg | echo ""Obj_Name"is up to date"
endif
else
let s:Sou_Error = 1
echohl WarningMsg | echo " please choose the correct source file"
endif
exe ":setlocal makeprg=make"
endfunc
func! Link()
call Compile()
if s:Sou_Error || s:LastShellReturn_C != 0
return
endif
let s:LastShellReturn_L = 0
let Sou = expand("%:p")
let Obj = expand("%:p:r").s:Obj_Extension
if g:iswindows
let Exe = expand("%:p:r").s:Exe_Extension
let Exe_Name = expand("%:p:t:r").s:Exe_Extension
else
let Exe = expand("%:p:r")
let Exe_Name = expand("%:p:t:r")
endif
let v:statusmsg = ''
if filereadable(Obj) && (getftime(Obj) >= getftime(Sou))
redraw!
if !executable(Exe) || (executable(Exe) && getftime(Exe) < getftime(Obj))
if expand("%:e") == "c"
setlocal makeprg=gcc -o %< %<.o
echohl WarningMsg | echo " linking..."
silent make
elseif expand("%:e") == "cpp" || expand("%:e") == "cxx"
setlocal makeprg=g++ -o %< %<.o
echohl WarningMsg | echo " linking..."
silent make
endif
redraw!
if v:shell_error != 0
let s:LastShellReturn_L = v:shell_error
endif
if g:iswindows
if s:LastShellReturn_L != 0
exe ":bo cope"
echohl WarningMsg | echo " linking failed"
else
if s:ShowWarning
exe ":bo cw"
endif
echohl WarningMsg | echo " linking successful"
endif
else
if empty(v:statusmsg)
echohl WarningMsg | echo " linking successful"
else
exe ":bo cope"
endif
endif
else
echohl WarningMsg | echo ""Exe_Name"is up to date"
endif
endif
setlocal makeprg=make
endfunc
func! Run()
let s:ShowWarning = 0
call Link()
let s:ShowWarning = 1
if s:Sou_Error || s:LastShellReturn_C != 0 || s:LastShellReturn_L != 0
return
endif
let Sou = expand("%:p")
let Obj = expand("%:p:r").s:Obj_Extension
if g:iswindows
let Exe = expand("%:p:r").s:Exe_Extension
else
let Exe = expand("%:p:r")
endif
if executable(Exe) && getftime(Exe) >= getftime(Obj) && getftime(Obj) >= getftime(Sou)
redraw!
echohl WarningMsg | echo " running..."
if g:iswindows
exe ":!%<.exe"
else
if g:isGUI
exe ":!gnome-terminal -e ./%<"
else
exe ":!./%<"
endif
endif
redraw!
echohl WarningMsg | echo " running finish"
endif
endfunc

怎麼用有注釋,直接放到你vimrc文件的最後就可以

閱讀全文

與vimforwindows編譯相關的資料

熱點內容
linuxsed正則 瀏覽:109
linux安裝gz文件 瀏覽:357
linux如何卸載編譯的軟體 瀏覽:929
高三解壓活動視頻 瀏覽:780
如何把伺服器卡爆 瀏覽:949
餓了么java程序員 瀏覽:960
python編譯時找不到路徑 瀏覽:910
jpg轉換pdf軟體 瀏覽:103
php讀取json文件 瀏覽:866
螺桿壓縮機的功率計算 瀏覽:74
谷輪壓縮機c 瀏覽:338
蘋果app如何復制到另一個手機 瀏覽:834
javasession超時 瀏覽:831
易金通app怎麼更改手機號 瀏覽:493
plc數控編程的方法 瀏覽:989
android只能輸入數字和字母 瀏覽:120
文件夾如何刪除頁碼 瀏覽:993
伺服器被封了有什麼後果 瀏覽:980
光大手機app怎麼零存整取 瀏覽:416
cshtml需要編譯 瀏覽:580