问题描述
在MinGW-W64在线安装程序中,您可以选择几个字段。然而,我找不到任何文档,我所做的猜测并没有给我想要的行为。显然,很多工作已经进入项目,因此缺乏基本文件,阻碍了这一举措似乎令人遗憾。
版本和架构字段不言自明,但我遇到的其他字段(以当前安装程序显示的值):
- 线程,选项 posix 和 win32
- 异常,选项矮人和 sjlj
- 构建版本,选项 0 , 1 , 2 。
在我以前的安装中选择了 win32 , seh 和 1 (显然这些选项自那时以来已经改变了,但我并不明白什么是什么)。
每个选项的优点和缺点是什么,特别是线程模型和异常处理和哪个版本是最好的?
使用 x86_64-win32-seh-rev1 $ c遇到的具体问题$ c $是:
$ b $ ul
我可以应付调试问题,但它对于有工作的C ++ 11线程。
异常
请请参阅。
线程
您可以决定想要的线程类型使用:POSIX线程或Windows API线程。 posix线程具有可移植性的优点;你可以在没有修改的情况下在其他posix平台(例如linux)上使用你的代码。 win32线程API仅适用于Windows。如果你在windows上是100%,并且像api那样,那也没有问题。
如果你使用新的C ++特性,比如 std :: thread 因为你已经有了一个标准的线程API,所以这个影响不太明显。我不确定如果你不直接使用posix- / win32线程API(也许 std :: thread native句柄?),那么它是否真的有很大的不同?
另请参阅:
构建版本
我猜这是Mingw( - w64)遵循GCC版本(4.8.x,4.9.x等)。如果您不需要特定版本,则应使用最新版本。
线程问题
如果抛出的异常是:
在抛出'std :: system_error'实例后终止
what():启用多线程来使用std :: thread:不允许操作
然后只是 link 如果您没有理由使用特定的选项;我的个人推荐:
建议
posix - dwarf - 2
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):
- Threads, options posix and win32
- Exception, options dwarf and sjlj
- Build revision, options 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).
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:
- std::thread and std::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.
I can cope with the debugging problem but it would be really nice to have working C++11 threads.
Exceptions
Please see this answer for all three models (dwarf, sjlj and 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.
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?)
See also: mingw-w64 threads: posix vs 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.
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.
Recommendation
If you don't have reasons to use a specific option; my personal recommendation:
posix - dwarf - 2
- Posix enable C++11 <thread>, <mutex> and <future>
- dwarf is faster
- 2 because it's the latest release
这篇关于mingw-w64安装程序中选项的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!