For multithreading concurrent program in C++, for example:
1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <thread>
void thread_init() {
std::cout<<"This statement is executed in the new thread\n";
}
int main() {
std::thread t(thread_init);
std::cout<<"This statement is executed in the main thread\n";
t.join();
}
This error might occur due to dynamic library error
Solution:
Compile with argument:
1
-static-libgcc -static-libstdc++