2
Hello, I’m using mingw, 32-bit version in windows 7 Ultimate and I’m having trouble using threads.
I know they don’t work for this version of mingw, which is why I use the version in this link. But I don’t compile this example, because it says
In Static Member Function 'Static unsigned int mingw_stdthread::thread:_hardware_concurrency_helper()':
error: '::Getnativesysteminfo' has not been declared (in line 266)
This in the thread file I downloaded, tested on this site and worked this example, someone could tell me why this happens?
#include <iostream> // std::cout
#include <thread> // std::thread
class test {
public:
static void foo(){}
static void bar(int x){}
test(){
std::thread first (foo); // spawn new thread that calls foo()
std::thread second (bar,0); // spawn new thread that calls bar(0)
first.join(); // pauses until first finishes
second.join(); // pauses until second finishes
}
};
int main() {
test TESTE;
return 0;
}
Herm.. And what’s the problem?
– Kahler
@Kahler edited the post.
– Simple coder
What were the flags/flags you passed to mingw?
– Mário Feroldi
Similar problem.
– Mário Feroldi
@Márioferoldi I didn’t pass any flag and already tried with the tag -pthread, unsuccessfully, and had already found this post when I went looking for the answer.
– Simple coder
@Simplecoder I adjusted the link you provided to contain your example code (it will appear when some editor approves).
– Kahler