We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
由于这里的每个人都没有注意到您明确的 64 位声明,因此我将给出正确的答案:
如果 makefile 是 Nmake makefile,则可以安装 Visual Studio Express for Windows Desktop,从开始菜单打开命令提示符(选择针对 64-位 Windows),
cd
到您的项目目录,然后运行 nmake
。您需要修改 makefile 以调用 cl 和链接。如果 Makefile 是 MinGW makefile,则需要 mingw -w64 针对 Win64 的工具链(注意还提供了 32 位工具链)。我推荐 通过安装程序提供的官方版本或可从 MSYS2 安装的版本(请参阅第 3 点)。安装,打开 MinGW-w64 命令提示符,
cd
到您的项目目录,然后运行 mingw32-make
。如果Makefile是Unix/MSYS makefile,我建议使用MSYS2。您可以使用上述工具链,或者执行
pacman -S mingw-w64-x86_64-gcc
从 MSYS2 shell 安装工具链。请务必将/mingw64/bin
添加到PATH
或从“MSYS2 MinGW-w64 64-bit”快捷方式启动以使用它。请注意,您只能使用 MSYS2 作为包管理工具:安装您想要的任何依赖项(有大量的 3rd 方库二进制文件可供使用),然后只需添加/mingw64/bin
目录到PATH
并从任何地方调用编译器。如果项目使用 Unix 功能(例如
fork()
或其他 Unix 系统调用),则可以使用 64 位 Cygwin,安装其编译器,并链接到 Cygwin dll。不建议这样做,因为这会带来性能(相对于将代码移植到 Win32 API 而言)和许可证损失(Cygwin DLL 是 GPL,这会强制您的程序以 GPL 兼容方式获得许可)。以下是使用免费工具为 64 位 Windows 编译 C 源文件的四种方法。如果您是学生,您也可以使用以下方法:
从 Dreamspark(如果您的大学/学院/学校与 Microsoft 就此达成协议)并使用它。几乎等同于第 1 点,除非您使用 MFC/ATL 和/或 VS 插件之类的东西,这些插件在 Express 版本中不起作用。
从教育产品网站下载英特尔编译器。但从第 5 点开始需要 Visual Studio Professional。不过,您需要修改 Makefile 才能使用英特尔编译器。
从此处下载 LLVM/Clang 编译器(Windows 快照版本)并将其与第 5 点。您需要修改 makefile 以调用 clang。
我知道这超出了您的要求,但我的高评价答案必须完整,对吧?
Since everyone here is oblivious to your clear 64-bit statement, I'll give a correct answer:
If the makefile is an Nmake makefile, you can install the Visual Studio Express for Windows Desktop, open a command prompt from the start menu (choose the one targetting 64-bit Windows),
cd
to your project's directory, and runnmake
. You'll need to modify the makefile to call cl and link.If the Makefile is a MinGW makefile, you will need mingw-w64's toolchains targetting Win64 (note also 32-bit toolchains are provided). I recommend the official builds provided through an installer or the ones installable from MSYS2 (see point 3). Install, open the MinGW-w64 command prompt,
cd
to your projects directory, and runmingw32-make
.If the Makefile is a Unix/MSYS makefile, I suggest using MSYS2. You can use the above toolchain, or do
pacman -S mingw-w64-x86_64-gcc
to install a toolchain from the MSYS2 shell. Be sure to either add/mingw64/bin
toPATH
or launch from the "MSYS2 MinGW-w64 64-bit" shortcut to use it. Note you can use MSYS2 as a package management tool only: install any dependency you want (there are tons of 3rd party library binaries ready for use) and just add the<MSYS2 root>/mingw64/bin
directory toPATH
and call the compiler from anywhere.If the project uses Unix functionality (like
fork()
or other Unix system calls), you can use 64-bit Cygwin, install its compiler, and link with the Cygwin dll. This is not recommended as there is a performance (well, relative to porting the code to Win32 APIs) and license penalty (The Cygwin DLL is GPL, which forces your program to be licensed in a GPL-compatible way).These are four ways of compiling a C source file for 64-bit Windows with free tools. If you are a student, you can probably use the following ways as well:
Download Visual Studio Professional from Dreamspark (if your university/college/school has an agreement with Microsoft for this) and use that. Pretty much equivalent to point 1 except if you use stuff like MFC/ATL and/or VS plugins, which don't work in the express version.
Download the Intel compiler from their Education offerings website. Requires Visual Studio Professional from point 5 though. You'll need to modify the Makefile to use the Intel compiler though.
Download the LLVM/Clang compiler from here (the Windows snapshot builds) and use it in conjunction with point 5. You'll need to modify the makefile to call clang.
I know this is more than what you asked for, but my high-rated answers need to be complete, right?
您可以使用 Visual C 并查看 nmake
请参阅:如何在 Visual Studio 中使用 makefile ?
You could use Visual C and look at nmake
see: How to use makefiles in Visual Studio?
您可以尝试 MinGW 来获得与 GCC 类似的 makefile。
You could try MinGW to have makefiles similar to GCC ones.
看看 http://www.cygwin.com/
Have a look at http://www.cygwin.com/
Code::Blocks 带有内置的 Mingw 环境,它应该只处理 makefile美好的。
Code::Blocks comes with a built in Mingw environment, which should handle makefiles just fine.