MinGW 5.3.0-2 不工作

MinGW 5.3.0-2 not working

升级到MinGW 5.3.0-2(实际版本)后出现奇怪的错误

I checked everything because It's the 5th time i reinstall it and thought it would help

Code::Blocks 输出这个:

mingw32-g++.exe -Wall -fexceptions -g  -c C:\Users\Tudor\Documents\C++\test\main.cpp -o obj\Debug\main.o
mingw32-g++.exe  -o bin\Debug\test.exe obj\Debug\main.o   
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lpthread
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))

注意:如果我检查 -std=c++11 或 -std=c++14 标志,我会得到如下输出:

是不是上个版本的MinGW有问题?如果是这样,我在哪里可以获得最后一个工作版本?还是我电脑里的东西出了问题?如果可以修复它,我想保留这个版本,但它让我抓狂

如果你使用codeblocks-16.01-nosetup版本或更早的类似版本,那么你需要在C盘的主目录(C:\MinGW)安装MinGW,并且你必须在系统中添加"C:\MinGW\bin"名为 "Path" 的变量。 但是,我建议使用 "codeblocks-16.01mingw-setup.exe" 版本的代码块。这有一个预加载的 MinGW 最新版本。你可以从这里得到它:https://sourceforge.net/projects/codeblocks/files/Binaries/16.01/Windows/codeblocks-16.01mingw-setup.exe/download

您还没有安装 Posix Threads (pthread) 库,所以链接器 找不到它。您选择的特定 Windows GCC 打包器没有 默认安装。

启动 MinGW 安装管理器并导航 所有包 -> MinGW -> MinGW 标准库。在提供的标准库中,select mingw32-pthreads-w32 dev。然后从菜单栏 select Installation -> Apply Changes 并继续。让它看起来像

较新的 Windows GCC 打包程序,例如mingw-w64TDM-GCC,将默认安装 pthreads 并且 提供 64 位和 32 位编译器。 mingw-w64 还提供了更多最新的 GCC 版本(当前为 6.2,这是最新的 GCC 版本)。