problem with mingw 4.5.2 and prebuilt boost 1.46.1 libs

Hi Everybody!

I would like to use mingw 4.5.2 with prebuilt boost 1.46.1 libs. I didn't want to compile the boost source because saving time therefore I downloded it from http://www.cogniteam.com/wiki/index.php?title=Main_Page webpage.

There are appropriate libs for mingw 4.5.2 When I compiled my source with boost test it worked fine. However I want to use boost thread too. I found a common small tutorial code on google.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <boost/thread/thread.hpp>
#include <iostream>

void hello()
{
  std::cout <<
    "Hello world, I'm a thread!"
    << std::endl;
}

int main(int argc, char* argv[])
{
  boost::thread thrd(&hello);
  thrd.join();
  return 0;
}



I gave this command:

g++ t1.cpp -llibboost_thread-mgw44-mt-1_46_1 -Lm:/boost/lib -Im:/boost

I could compile successfully and link this program and I got nothing error messages. If I want to execute this program, It quits immediately after launching. Nothing error message, exception etc.


What did I do wrong?

Thank you.

Regards,
Zoltán
Could it be that you are running your code from eclipse ? We noticed the console closes quickly there.
Try running it from the system console or in debug mode. We tried your code and it works for us.
Topic archived. No new replies allowed.