導航:首頁 > 源碼編譯 > 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編譯相關的資料

熱點內容
記事本dos命令 瀏覽:271
伺服器如何搭建多個節點 瀏覽:324
acx演算法 瀏覽:256
幽冥詭匠漫畫全集用什麼app可以看 瀏覽:1001
租用伺服器為什麼越來越慢 瀏覽:960
演算法創新就業方向 瀏覽:423
演算法最優解作者 瀏覽:867
通達信紅綠寶塔線指標源碼 瀏覽:667
app是什麼東西合法嗎 瀏覽:231
怎麼鎖app視頻教程 瀏覽:841
迅捷pdf注冊碼生成器 瀏覽:748
androidsdkosx 瀏覽:303
壓縮面膜紙熒光 瀏覽:841
app怎麼分身三個 瀏覽:744
電影bt下載源碼 瀏覽:422
iwatch屏幕加密晶元 瀏覽:570
公安主題網站源碼 瀏覽:986
天津市伺服器供應商雲伺服器 瀏覽:115
數控車床子程序編程 瀏覽:111
floydwarshall演算法 瀏覽:719