简体   繁体   English

用崇高的文字3编译C文件

[英]Compiling C files with sublime text 3

I started learning C for my studies, and I'd like to use Sublime Text 3 to compile those files. 我开始学习C进行学习,我想使用Sublime Text 3来编译这些文件。 I've been using CodeBlocks before, but I'm already using Sublime Text for LaTeX and Python. 以前我一直在使用CodeBlocks,但是我已经在LaTeX和Python中使用Sublime Text。

I've downloaded the gcc.exe file, saved in C:\\Program Files\\WinBuilds\\bin and added it to the Path. 我已经下载了gcc.exe文件,保存在C:\\ Program Files \\ WinBuilds \\ bin中,并将其添加到路径中。

I've created a new build system: 我创建了一个新的构建系统:

{   
"cmd" : ["gcc", "$file_name", "-o", "${file_base_name}"],
"selector" : "source.c",
"shell":true,
"working_dir" : "$file_path"
}

I get the following output: 我得到以下输出:

cc1.exe: fatal error: Files/WinBuilds/WinBuilds/include: No such file or directory
compilation terminated.
[Finished in 0.2s with exit code 1]
[cmd: ['gcc', 'Rect.c', '-o', 'Rect']]
[dir: C:\Users\Matthieu KUNTZ\Desktop\Rectangle]
[path: C:\Program Files\Python3.4.3\;C:\Program Files\Python3.4.3\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MiKTeX 2.9\miktex\bin\;C:\Program Files\SumatraPDF;C:\Program Files\Skype\Phone\;C:\Program Files\WinBuilds\bin]

What should I do to be able to compile and run simple C files ? 我应该怎么做才能编译和运行简单的C文件?

gcc has a whole installation that comes with it. gcc附带了一个完整的安装程序。 Just the gcc.exe won't do you any good. 只是gcc.exe不会对您有任何好处。 Take the steps outlined here to find out how to exactly install the complete package. 执行此处概述的步骤以了解如何准确安装完整的软件包。 Install it to the directory your gcc.exe is currently in, then your compiling should work. 将其安装到您的gcc.exe当前所在的目录中,然后即可进行编译。

If you do not install gcc properly, the exe wont know where to find all the things a complete-solution compiler needs to function (linker, header files, scripts, auxillary files, etc). 如果您没有正确安装gcc,则exe不会知道在哪里可以找到完整解决方案编译器需要运行的所有内容(链接器,头文件,脚本,辅助文件等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM