on Wed May 30 2007, Scott Meyers
Bobby Ward wrote:
Fortunately/Unfortunately you have to specify the library as
-lboost_regex-mgw41-1_34
Hoo-ray, it finally works. Thanks very much for this crucial information. FWIW, use of the LIBRARY_PATH environment variable works, too, so my successful command line looks like this:
D:\Temp>g++ -Wall -O3 -ID:\C++\Boost\Current -o boostbuildtest.exe boostbuildtest.cpp -lboost_regex-mgw41-1_34 -lboost_filesystem-mg w41-1_34
While trying to resolve this issue, I noticed during my search of the Boost User newsgroup that I was only one of several people having difficulty getting Boost to link with gcc, especially because, IIUC, things changed from 1.33 to 1.34. Better documentation would help. For example, http://www.boost.org/more/getting_started/windows.html says "On Windows, append a version number even if you only have one version installed (unless you are using the msvc or gcc toolsets, which have special version detection code) or auto-linking will fail." This strongly suggests that gcc supports auto-linking in a manner similar to MSVC,
...oooh, I didn't see that one coming. Would you please enter a Trac ticket for that problem at svn.boost.org and assign it to me?
so I was surprised that what worked for MSVC did not work for gcc. Later on that page I read "Most Windows compilers and linkers have so-called “auto-linking support," and since g++ is commonly used on Windows, I assumed that it fell into the "Most Windows compilers" category.
Ah. So, BTW, are you using cygwin or mingw?
It would be nice if that page didn't limit its examples to MSVC. I know it's not practical to cover all possible compilers, but it seems to me that the big two are VC++ and gcc,
Really, VC++ is the BIG ONE. Something like 95% of all C++ programmers are using it, according to a very reliable source.
so it'd be nice to have examples using both front and center.
It was my educated guess that most people using gcc on windows were using Cygwin and trying to build from the cygwin bash prompt, which according to the getting started guide, would have them following the directions at http://boost.org/more/getting_started/unix-variants.html even when building on Windows. That document shows only examples that will work with g++. I really had to strongly resist adding alternative cases in writing this getting started guide in order to keep it simple. I'm reluctant to add g++, because then someone will ask why there are no examples for borland, intel, DMC++, etc... it's a slippery slope. But you're a master of writing understandable tutorials... if you can suggest specific changes that don't undermine the simplicity of the document I'll happily apply them. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com