简体   繁体   English

在Windows上使用Makefile编译C文件

[英]Compile C File Using Makefile On Windows

I have a project with a .c file and a Makefile containing "compilation rules" for the gcc compiler. 我有一个带有.c文件和包含用于gcc编译器的“编译规则”的Makefile的项目。 I'm having trouble finding a way to compile it into an executable on my Windows 8 machine. 我在寻找一种将其编译为Windows 8计算机上的可执行文件时遇到麻烦。 It was straight-forward on Ubuntu . 它在Ubuntu上很简单。

It should also be as simple as installing gcc and using the command line to switch to that directory and using the make command. 它也应该像安装gcc并使用命令行切换到该目录并使用make命令一样简单。

I'm stuck at the installation part since I can't find an easy or well documented solution. 由于无法找到简单或有据可查的解决方案,因此我被困在安装部分。

Please suggest me a piece of software for this task. 请为我推荐一个用于该任务的软件。 I do need step-by-step instructions to make the make command available on the command line globally using eg MinGW since it doesn't do it itself nor tells anything about it. 我确实需要分步说明,以便使用例如MinGW在命令行上使make命令在全局范围内可用,因为它本身并不会执行任何操作,也不会提供任何信息。

You need to modify the PATH variable so it includes the directory for your MinGW binaries: 您需要修改PATH变量,以便它包含您的MinGW二进制文件的目录:

C:\>echo %PATH%
...;D:\bin-win64\mingw64\bin;...

For more information, see 有关更多信息,请参见

https://superuser.com/questions/502358/easier-way-to-change-environment-variables-in-windows-8 https://superuser.com/questions/502358/easier-way-to-change-environment-variables-in-windows-8

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

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