mingw-w64 安装程序中选项的含义 [英] Meaning of options in mingw-w64 installer
问题描述
在 MinGW-W64 在线安装程序中,您可以选择几个字段.但是我找不到任何关于此的文档,而且我所做的猜测并没有给我想要的行为.
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.
显然,该项目已经投入了大量工作,因此遗憾的是,由于缺乏基本文档,因此无法采用.
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):
- 线程,选项
posix
和win32
- Exception,选项
dwarf
和sjlj
- 构建修订版,选项
0
、1
、2
.
- Threads, options
posix
andwin32
- Exception, options
dwarf
andsjlj
- Build revision, options
0
,1
,2
.
我在之前的安装中选择的值是 win32
、seh
和 1
(很明显,从那时起选项已经改变,但我没有更明智的是什么).
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).
每个选项的优缺点是什么,尤其是线程模型和异常处理,哪个版本是最好的"?
What are the pros and cons of each option, especially the threading model and exception handling, and which version is "best"?
我使用x86_64-win32-seh-rev1
遇到的具体问题有:
The specific problems I have encountered using x86_64-win32-seh-rev1
are:
std::thread
和std::condition_variable
不受支持- 在调试时(使用 Code::Blocks 作为 IDE),如果抛出异常,它不会跳转到异常处理程序;选择 Next Line 3 次什么都不做,然后中止运行.
我可以处理调试问题,但如果有工作的 C++11 线程会非常好.
I can cope with the debugging problem but it would be really nice to have working C++11 threads.
推荐答案
异常
您可以决定要使用哪种线程:POSIX 线程或 Windows API 线程.posix线程具有可移植性的优点;您可以在其他 posix 平台(例如 linux)上使用您的代码而无需修改.win32 线程 API 仅适用于 Windows.如果你 100% 使用 Windows 并且喜欢它的 api,那也没问题.
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.
如果您使用诸如 std::thread
之类的新 C++ 功能,则影响不太明显,因为您已经有了用于线程的标准 api.我不确定如果你不直接使用 posix-/win32 线程 api 是否真的有很大的不同(可能是 std::thread
原生句柄?)
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?)
另请参阅:mingw-w64 线程:posix vs win32
我猜这只是另一个版本号,因为 Mingw(-w64) 遵循 GCC 版本(4.8.x、4.9.x 等).如果您不需要特定版本,则应使用最新版本.
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.
如果抛出的异常是:
terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted
然后只需 链接 pthreads - 问题就解决了.
then just link pthreads - and the problem is solved.
如果您没有理由使用特定选项;我个人的建议:
If you don't have reasons to use a specific option; my personal recommendation:
posix - dwarf - 2
- Posix 启用 C++11
、
和 - 矮人更快
- 2 因为它是最新版本
- Posix enable C++11
<thread>
,<mutex>
and<future>
- dwarf is faster
- 2 because it's the latest release
这篇关于mingw-w64 安装程序中选项的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!