Basically I want to compile C/C++ using the GCC on Windows. The two competing platforms, as i see it, are MinGW and Cygwin. Each have their own benifits and limitations. MinGW compiles for Windows, whereas Cygwin needs the cygwin .dll. However installing libraries on MinGW is difficult, whereas on cygwin it's easier, using the setup.exe as a 'package manager'.
基本上我想在Windows上使用GCC编译C / C ++。正如我所看到的,两个竞争平台是MinGW和Cygwin。每个都有自己的好处和限制。 MinGW为Windows编译,而Cygwin需要cygwin .dll。但是在MinGW上安装库很困难,而在cygwin上使用setup.exe作为“包管理器”则更容易。
My question is what's the best way to compile on Windows. Would it be better to use MinGW and struggle with libraries (in which case is there an easy way of installing libraries on MinGW). Or should I use Cygwin, if so how do I get it to compile without needing the cygwin .dll, effectively compile for normal Windows.
我的问题是在Windows上编译的最佳方法是什么。使用MinGW并与图书馆斗争会更好(在这种情况下,有一种简单的方法可以在MinGW上安装库)。或者我应该使用Cygwin,如果是这样我如何在不需要cygwin .dll的情况下编译它,有效地编译正常的Windows。
9 个解决方案
#1
7
The easiest and best way to compile on windows is to use visual studio express. It is free. A good reason for using cygwin is for cross platform builds. A good reason to use gcc is it supports some compiler candy the Microsoft compiler doesn't.
在Windows上编译的最简单和最好的方法是使用visual studio express。这是免费的。使用cygwin的一个很好的理由是跨平台构建。使用gcc的一个很好的理由是它支持微软编译器没有的一些编译器糖果。
But all in all VC++ Express is the way to go for windows only development.
但是所有VC ++ Express都是开发Windows的方法。
#2
5
There is always the option of using -mno-cygwin
with Cygwin to compile against Windows libraries like MinGW does:
总是可以选择使用-mno-cygwin和Cygwin来编译像MinGW那样的Windows库:
gcc -mno-cygwin file.c -o test
It's not an easy choice and mainly depends on how much you will rely on other libraries. Cygwin really adds an additional layer, which is heavier but "emulates" the Linux environment better than MinGW.
这不是一个简单的选择,主要取决于您将依赖其他库的程度。 Cygwin确实添加了一个额外的层,它比MinGW更重,但“更好地”模拟Linux环境。
Edit:
Qt Creator allows you to compile with MinGW on Windows (and gcc on Linux, ...), has an IDE that makes debugging more friendly than gdb. If you need libraries, you still have the option of using the Qt libraries. That would be a good alternate solution to the Visual Studio if you really want to stick to gcc for future portability.
Qt Creator允许你在Windows上使用MinGW进行编译(在Linux上使用gcc,...),有一个IDE使调试比gdb更友好。如果您需要库,您仍然可以选择使用Qt库。如果你真的想坚持使用gcc以便将来移植,那对Visual Studio来说这将是一个很好的替代解决方案。
#3
3
You might want to look at CodeBlocks. It is generally used to build WxWidgets apps, but it wraps MinGW nicely.
您可能希望查看CodeBlocks。它通常用于构建WxWidgets应用程序,但它很好地包装了MinGW。
#4
1
Actually, there's option #3: if your edition of Windows permits it, you can install Microsoft Services For Unix / Subsystem for Unix Applications, and then get gcc from SUACommunity. It has a package manager, too. Of those 3 options, this will give you behavior closest to a true Unix system.
实际上,有选项#3:如果您的Windows版本允许,您可以安装Microsoft Services for Unix / Subsystem for Unix Applications,然后从SUACommunity获取gcc。它也有一个包管理器。在这3个选项中,这将为您提供最接近真正Unix系统的行为。
However, the resulting applications aren't Win32 applications; they're SUA applications, and will require SUA to run. If you write code for yourself, it's usually not a problem if you write code for yourself, but if you want to write and distribute a proper Windows application, I would suggest staying away from anything that tries to emulate Unix, so MinGW it is.
但是,生成的应用程序不是Win32应用程序;它们是SUA应用程序,需要SUA才能运行。如果你自己编写代码,如果你自己编写代码通常不是问题,但如果你想编写和发布一个合适的Windows应用程序,我建议远离任何试图模仿Unix的东西,所以MinGW就是这样。
#5
1
Qt Creator comes with MinGW as standard and can be used to build projects that don't actually use the Qt framework.
Qt Creator标配MinGW,可用于构建实际不使用Qt框架的项目。
#6
0
There's an easy to install MinGW wrapped GCC at equation.com. Click "Programming Tools" then "Fortran, C, C++", download the release you prefer, install and use.
在equation.com上有一个易于安装的MinGW包装GCC。单击“编程工具”,然后单击“Fortran,C,C ++”,下载您喜欢的版本,安装和使用。
#7
0
One possible method is to use CMake which can build Visual Studio project from your sources and then compile from Visual Studio. It can build project for other IDEs too, so you can go cross platform.
一种可能的方法是使用CMake,它可以从您的源构建Visual Studio项目,然后从Visual Studio进行编译。它也可以为其他IDE构建项目,因此您可以跨平台。
#8
0
I think the answer depends on whether you intend to use libraries or compile programs that are targeted to POSIX or a POSIX-based target. That's what Cygwin is intended for, while MinGW is more intended for compiling Windows-targeted programs using GCC.
我认为答案取决于您是打算使用库还是编译针对POSIX或基于POSIX的目标的程序。这就是Cygwin的目的,而MinGW更倾向于使用GCC编译以Windows为目标的程序。
#9
0
Another option is TDM MinGW: http://www.tdragon.net/recentgcc/
另一个选择是TDM MinGW:http://www.tdragon.net/recentgcc/
It's basically an unofficial fork of MinGW with the latest GCC compiler available for both 32- and 64bit windows machines. Even some MinGW developers themselves use it.
它基本上是MinGW的非官方分支,最新的GCC编译器可用于32位和64位Windows机器。甚至一些MinGW开发人员自己也使用它。
Equation Gcc is even better: http://www.equation.com/servlet/equation.cmd?fa=fortran
公式Gcc甚至更好:http://www.equation.com/servlet/equation.cmd?fa = fortran
#1
7
The easiest and best way to compile on windows is to use visual studio express. It is free. A good reason for using cygwin is for cross platform builds. A good reason to use gcc is it supports some compiler candy the Microsoft compiler doesn't.
在Windows上编译的最简单和最好的方法是使用visual studio express。这是免费的。使用cygwin的一个很好的理由是跨平台构建。使用gcc的一个很好的理由是它支持微软编译器没有的一些编译器糖果。
But all in all VC++ Express is the way to go for windows only development.
但是所有VC ++ Express都是开发Windows的方法。
#2
5
There is always the option of using -mno-cygwin
with Cygwin to compile against Windows libraries like MinGW does:
总是可以选择使用-mno-cygwin和Cygwin来编译像MinGW那样的Windows库:
gcc -mno-cygwin file.c -o test
It's not an easy choice and mainly depends on how much you will rely on other libraries. Cygwin really adds an additional layer, which is heavier but "emulates" the Linux environment better than MinGW.
这不是一个简单的选择,主要取决于您将依赖其他库的程度。 Cygwin确实添加了一个额外的层,它比MinGW更重,但“更好地”模拟Linux环境。
Edit:
Qt Creator allows you to compile with MinGW on Windows (and gcc on Linux, ...), has an IDE that makes debugging more friendly than gdb. If you need libraries, you still have the option of using the Qt libraries. That would be a good alternate solution to the Visual Studio if you really want to stick to gcc for future portability.
Qt Creator允许你在Windows上使用MinGW进行编译(在Linux上使用gcc,...),有一个IDE使调试比gdb更友好。如果您需要库,您仍然可以选择使用Qt库。如果你真的想坚持使用gcc以便将来移植,那对Visual Studio来说这将是一个很好的替代解决方案。
#3
3
You might want to look at CodeBlocks. It is generally used to build WxWidgets apps, but it wraps MinGW nicely.
您可能希望查看CodeBlocks。它通常用于构建WxWidgets应用程序,但它很好地包装了MinGW。
#4
1
Actually, there's option #3: if your edition of Windows permits it, you can install Microsoft Services For Unix / Subsystem for Unix Applications, and then get gcc from SUACommunity. It has a package manager, too. Of those 3 options, this will give you behavior closest to a true Unix system.
实际上,有选项#3:如果您的Windows版本允许,您可以安装Microsoft Services for Unix / Subsystem for Unix Applications,然后从SUACommunity获取gcc。它也有一个包管理器。在这3个选项中,这将为您提供最接近真正Unix系统的行为。
However, the resulting applications aren't Win32 applications; they're SUA applications, and will require SUA to run. If you write code for yourself, it's usually not a problem if you write code for yourself, but if you want to write and distribute a proper Windows application, I would suggest staying away from anything that tries to emulate Unix, so MinGW it is.
但是,生成的应用程序不是Win32应用程序;它们是SUA应用程序,需要SUA才能运行。如果你自己编写代码,如果你自己编写代码通常不是问题,但如果你想编写和发布一个合适的Windows应用程序,我建议远离任何试图模仿Unix的东西,所以MinGW就是这样。
#5
1
Qt Creator comes with MinGW as standard and can be used to build projects that don't actually use the Qt framework.
Qt Creator标配MinGW,可用于构建实际不使用Qt框架的项目。
#6
0
There's an easy to install MinGW wrapped GCC at equation.com. Click "Programming Tools" then "Fortran, C, C++", download the release you prefer, install and use.
在equation.com上有一个易于安装的MinGW包装GCC。单击“编程工具”,然后单击“Fortran,C,C ++”,下载您喜欢的版本,安装和使用。
#7
0
One possible method is to use CMake which can build Visual Studio project from your sources and then compile from Visual Studio. It can build project for other IDEs too, so you can go cross platform.
一种可能的方法是使用CMake,它可以从您的源构建Visual Studio项目,然后从Visual Studio进行编译。它也可以为其他IDE构建项目,因此您可以跨平台。
#8
0
I think the answer depends on whether you intend to use libraries or compile programs that are targeted to POSIX or a POSIX-based target. That's what Cygwin is intended for, while MinGW is more intended for compiling Windows-targeted programs using GCC.
我认为答案取决于您是打算使用库还是编译针对POSIX或基于POSIX的目标的程序。这就是Cygwin的目的,而MinGW更倾向于使用GCC编译以Windows为目标的程序。
#9
0
Another option is TDM MinGW: http://www.tdragon.net/recentgcc/
另一个选择是TDM MinGW:http://www.tdragon.net/recentgcc/
It's basically an unofficial fork of MinGW with the latest GCC compiler available for both 32- and 64bit windows machines. Even some MinGW developers themselves use it.
它基本上是MinGW的非官方分支,最新的GCC编译器可用于32位和64位Windows机器。甚至一些MinGW开发人员自己也使用它。
Equation Gcc is even better: http://www.equation.com/servlet/equation.cmd?fa=fortran
公式Gcc甚至更好:http://www.equation.com/servlet/equation.cmd?fa = fortran