I use Dev-C++ 5.5.3. The linker reports me this error...why?
Why?
The pthread library is not compatible with Windows. Don't worry, there is a library for that. Called pthreads-win32 , you could also try std::thread
but your code seems mostly c
so better stick to pthread
Just downloaded Dev-C++ and checked, mingw does include the header files for pthread
but don't let this confuse you. Pthread is not compatible with Windows, so the implementation will not link.
Check the Tools -> Compiler Options -> Directories and add the proper directories for your library pthread win32.
And then add the command in Tools -> Compiler Options -> General for your library like this -llibpthread-win32 or the name you installed for the lib on your system.
std::thread
all over the programJust check that the version of your mingw for C++11 compatibility by adding the command -std=c++11 to your compiler. I suggest the newest version of g++ 4.8 since it includes the tool thread sanitizer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.