Search code examples
c++dllmingwboost-thread

c++ boost.thread executable not running


I'm new to c++ (but not from programing), and I wanted to create a program with thread. I installed boost (https://gist.github.com/zrsmithson/0b72e0cb58d0cb946fc48b5c88511da8) on my computer (windows), but when I run the executable the program just stop (no errors).

The program is the helloworld.cpp program inside the folder example. I think the issue is the lib (-lboost_thread-mgw63-mt-x32-1_66 -lboost_system-mgw63-mt-x32-1_66 -lboost_chrono-mgw63-mt-x32-1_66) or the compiler (MinGW). The code:

#include <boost/thread/thread.hpp>
#include <iostream>

void helloworld()
{
    std::cout << "Hello World!" << std::endl;
}

int main()
{
    boost::thread thrd(&helloworld);
    thrd.join();
}

Excuse me for my English. Thank you in advance for your help, Flayme


Solution

  • I resolved the issue by putting the library inside the folder where I compile, and then changed -L"\MinGW\lib" to -L.