在 Windows XP 中编译 C

标签 c vim gcc windows-xp path

我想学习 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/

相关文章:

c++ - 读取网络数据的最快方法?

c - 赋值 <指向常量数组的指针> = <指向数组的指针> : incompatible pointers

c++ - 为什么 gcc 生成一个 memmove 而不是 memcpy 来复制 std::vector<>?

c - (C 中的内联汇编)汇编程序消息 : Error: unknown pseudo-op:

linux - 在 gcc 搜索路径的末尾添加路径

c++ - 在每 t 毫秒执行一次 c++ 代码时执行测量

c - 多种资源的细粒度锁定算法

vim - 在插入模式或普通模式下,按<Esc>键一键保存文件

javascript - vim,在 html 中缩进 css 和 js 的正确方法

vim - 仅在终端中的 Vim 中使用当前缓冲区中的相对行号