windows mingw-w64 安装程序中选项的含义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29947302/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Meaning of options in mingw-w64 installer
提问by M.M
In the MinGW-W64 online installer there are several fields you can select. However I cannot find any documentation on this, and the guesses I've made don't give me the behaviour I want.
在 MinGW-W64 在线安装程序中,您可以选择多个字段。但是,我找不到任何关于此的文档,而且我所做的猜测并没有给我想要的行为。
Clearly a lot of work has gone into this project so it seems a pity that uptake is being held back by lack of basic documentation.
很明显,这个项目已经做了很多工作,所以很遗憾由于缺乏基本文档而阻碍了采用。
The "Version" and "Architecture" fields are self-explanatory but the other fields I have trouble with are (values shown as of current installer):
“版本”和“架构”字段是不言自明的,但我遇到的其他字段是(显示为当前安装程序的值):
- Threads, options
posix
andwin32
- Exception, options
dwarf
andsjlj
- Build revision, options
0
,1
,2
.
- 线程、选项
posix
和win32
- 例外、选项
dwarf
和sjlj
- 构建修订,期权
0
,1
,2
。
The values I chose on my previous install were win32
, seh
and 1
(clearly the options have changed since then but I am none the wiser as to what's what).
我在之前的安装中选择的值是win32
,seh
和1
(显然选项从那时起已经改变,但我不知道是什么)。
What are the pros and cons of each option, especially the threading model and exception handling, and which version is "best"?
每个选项的优缺点是什么,尤其是线程模型和异常处理,哪个版本是“最好的”?
The specific problems I have encountered using x86_64-win32-seh-rev1
are:
我在使用x86_64-win32-seh-rev1
中遇到的具体问题是:
std::thread
andstd::condition_variable
are not supported- When debugging (using Code::Blocks as IDE), if an exception is thrown it does not jump to the exception handler; selecting Next Line does nothing 3 times and then aborts the run.
std::thread
并且std::condition_variable
不受支持- 调试时(使用 Code::Blocks 作为 IDE),如果抛出异常不会跳转到异常处理程序;选择 Next Line 3 次什么都不做,然后中止运行。
I can cope with the debugging problem but it would be really nice to have working C++11 threads.
我可以解决调试问题,但如果有 C++11 线程工作真的很好。
采纳答案by ollo
Exceptions
例外
Please see this answer for all three models (dwarf, sjlj and seh).
请参阅所有三个模型(dwarf、sjlj 和 seh)的答案。
Threads
线程
You can decide what kind of threads you want to use: POSIX threads or Windows API threads. The posix threads have the advantage of portability; you can use your code on other posix platforms (eg. linux) without modifications. The win32 threading api is windows only. If you are 100% on windows and like it's api that's no problem though.
您可以决定要使用哪种线程:POSIX 线程或 Windows API 线程。posix 线程具有可移植性的优点;您可以在其他 posix 平台(例如 linux)上使用您的代码而无需修改。win32 线程 API 仅适用于 Windows。如果你 100% 使用 windows 并且喜欢它的 api,那没问题。
If you use new C++ features like std::thread
the impact is less visible since you already have a standard api for threading. I'm not sure if there's really a big difference if you don't use posix- / win32 thread api directly (maybe std::thread
native handles?)
如果您使用新的 C++ 特性,那么std::thread
这种影响就不那么明显了,因为您已经有了用于线程的标准 api。如果不直接使用 posix-/win32 线程 api(也许是std::thread
本机句柄?),我不确定是否真的有很大的不同。
See also: mingw-w64 threads: posix vs win32
另请参阅:mingw-w64 线程:posix 与 win32
Build revision
构建版本
I guess that's just another version number since Mingw(-w64) follows GCC versions (4.8.x, 4.9.x etc.). If you don't need an specific build, you should use the latest version.
我想这只是另一个版本号,因为 Mingw(-w64) 遵循 GCC 版本(4.8.x、4.9.x 等)。如果您不需要特定版本,则应使用最新版本。
Threading issue
线程问题
If the exception thrown is:
如果抛出的异常是:
terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted
then just link pthreads- and the problem is solved.
然后只需链接pthreads- 问题就解决了。
Recommendation
推荐
If you don't have reasons to use a specific option; my personal recommendation:
如果您没有理由使用特定选项;我的个人建议:
posix - dwarf - 2
- Posixenable C++11
<thread>
,<mutex>
and<future>
- dwarfis faster
- 2because it's the latest release
- Posix启用 C++11
<thread>
,<mutex>
和<future>
- 矮人更快
- 2因为它是最新版本