我想学习 Vim 编辑器,并且正在尝试编译一个 C 文件。我已经安装了 MinGW 并将 gcc.exe 添加到系统路径:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Arquivos de programas\TortoiseSVN\bin;c:\Arquivos de programas\Microsoft SQL Server\100\Tools\Binn\;c:\Arquivos de programas\Microsoft SQL Server\100\DTS\Binn\;C:\MinGW\bin\
在 Vim 中,我做了: :!gcc 代码.c -o gcc.exe 打开的 cmd 窗口显示以下文本:
C:\WINDOWS\system32\cmd.exe /c gcc -Wall code.c -o code.exe
gcc: code.c: No such file or directory
gcc: no input files
shell returned 1
Hit any key to close this window...
怎么了? 谢谢。
最佳答案
参见 this question对于完整的 .vimrc
,你需要的行是:
" Automatically cd into the directory that the file is in
autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' ')
关于在 Windows XP 中编译 C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3735847/