When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.
#include <iostream>#include <thread>#include <future>using namespace std;void initiazer(std::promise<int> * promObj){ std::cout<<"Inside Thread"<<std::endl; promObj->set_value(35);}int main(){ std::promise<int> promiseObj; std::future<int> futureObj = promiseObj.get_future(); std::thread th(initiazer, &promiseObj); std::cout<<futureObj.get()<<std::endl; th.join(); return 0;}
terminate called after throwing an instance of 'std::system_error' what(): Enable multithreading to use std::thread: Operation not permittedAbortedProcess returned 134
http://stackoverflow.com/questions/19463602/compiling-multithread-code-with-gIt's not related to CodeBlocksYves
-pthread -lpthread -Wl,--no-as-needed
-Wl,--no-as-needed
-Wl,--no-as-needed -lpthread
$ g++ -c main.cpp -pthread -std=c++11 $ g++ main.o -o main.out -pthread -std=c++11$ ./main.outInside Thread35