简体   繁体   English

mingw32 posix线程库

[英]mingw32 posix threading library

I have installed MinGW on my windows7 machine, using instructions from here . 我已经按照此处的说明在Windows7计算机上安装了MinGW。 Basically I used the GUI installer assistant called mingw-get-setup.exe. 基本上,我使用了名为mingw-get-setup.exe的GUI安装程序助手。 The installation manager allowed me to select a package called mingw32-libpthreadgc which installs bin/pthreadGC2.dll and bin/pthreadGCE2.dll . 安装管理器允许我选择一个名为mingw32-libpthreadgc的软件包,该软件包将安装bin/pthreadGC2.dllbin/pthreadGCE2.dll

To my knowledge that is not sufficient to compile code depending on the pthread library. 据我所知不足以根据pthread库编译代码。 Eg trying to compile a file with a header-include like #include "pthread.h" - to no surprise - results in a "file not found" compile error. 例如,尝试编译带有#include "pthread.h"类的标头包含文件#include "pthread.h" -毫不奇怪-导致“找不到文件”编译错误。 I can't find that header in my MinGW directory. 我的MinGW目录中找不到该标头。 If I use includes/headers from elsewhere, I'm afraid they might not match with the DLL's interface. 如果我使用其他位置的包含/标题,恐怕它们可能与DLL的接口不匹配。 How is this meant to be working? 这意味着如何工作?

(Furthermore I like to use CodeBlocks as the IDE. How would I set up a simple "HelloWorld"-like pthread program to get it all to work? There seems to be a lot of conflicting messages out there on how to set it up. Use "-pthread" vs "-lpthread". Set it in compiler and linker settings, right? Copy-paste the DLL's? What else???) (此外,我喜欢将CodeBlocks用作IDE。我将如何设置一个简单的类似于“ HelloWorld”的pthread程序以使其全部正常工作?关于如何设置它,似乎有很多冲突的消息。使用“ -pthread”和“ -lpthread”。在编译器和链接器设置中对其进行设置,对吗?复制粘贴DLL?还有什么??

I had similar problem, https://www.sourceware.org/pthreads-win32/ this did job for me, I used this in combination with mingw32. 我有类似的问题, https://www.sourceware.org/pthreads-win32/这确实对我有用,我将它与mingw32结合使用。 It also has nice README file. 它还具有不错的自述文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM