I don't see anything obviously wrong with that. My only question, is you say BOOST_HAS_THREADS is defined, are you defining it, or is Boost.Config defining it (if Boost.Config *isn't* setting it, then your project >settings are wrong for multithreaded code)? Are you selecting the regex lib to >link to manually or letting the auto-linking code do it's work (for minimum chances of bad things happening you should let the auto-linking code >select the correct binary)? HTH, John.
You should use _beginthread or _beginthreadex to start C++ thread when >using MSVC. CreateThread is too low level and does not do the per thread >initialization required. If you read MSDN documentation it explain why CreateThread >cannot be use with C++ program. Daniel Anderson
Thanks for the replies John and Daniel. I've reinstalled boost 1.47 making sure that all the multithreaded options were built and am using _beginthreadex() now, but the exact same problem seems to occur where the code snippet below crashes if and only if boost::regex_match() is called. I am not defining BOOST_HAS_THREADS in my code, it is defined automatically although I'm not sure how exactly. Also, as far as I know I am not manually linking to the necessary libraries; all I do is tell MSVC to look in "C:\Program Files\boost\boost_1_47_0\stage\lib" for additional libraries so presumably it chooses whichever one it needs. There are no thread or boost-related warnings in the build. Any other ideas? I really appreciate the help~ ... static const boost::regex expression("^[0-9]+"); ifstream myfile(x); //x is a different file name for every thread string line; if(myfile.is_open()) { while(myfile.good()) { getline(myfile, line); if(boost::regex_match(line, expression)) { //do stuff } } myfile.close(); } ...