I am using the following code snippet and compiling using the static linking.
#include<iostream>
#include <thread>
void hello()
{
std::cout<<"Hello Concurrent World\n";
}
int main()
{
std::thread t(hello);
t.join();
}
Here is the compilation command which I am using -
g++ -std=c++11 -o main -pthread -static -static-libgcc -static-libstdc++ temp.cpp
but when I try to execute the generated binary, I am getting segmentation fault.
But I dont see any error If I compile using the following command -
g++ -std=c++11 -o main2 -pthread temp.cpp
Can someone please help what might be causing the segmentation fault while compiling using the static linking.