Boost logo

Boost Users :

Subject: [Boost-users] [statechart] LNK2001 revisited
From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2010-08-12 13:23:11

Found a related post dated Jul 2007:

Attempted use of /Gm of course did not fix the problem (not sure why the
OP did that to begin with as it's pretty much incompatible with building
for release).

Information in this thread lead to an *apparent* sollution:

But I'm not really impressed by that sollution and the commentary on it
lead me to believe that I should not need it since I'm not making a

The issue appears when I set the /Yu flag (use precompiled headers) in
Visual Studio 2010. (10.0.30319.1) Without this flag active the program
eventually compiles and links without issue. With the flag active I get
exactly the same error as the OP though this is not regarding the
tutorial code, which I have not tested. I also have to set /Zm200 or
the build doesn't even get started (something about the space not being
large enough for my 50 line header).

The precompiled header is NOT including anything in boost statechart.
The only boost related includes are:


#include <boost/cast.hpp>
#include <boost/bind.hpp>
#include <boost/format.hpp>
#include <boost/parameter.hpp>
#include <boost/signals2.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/optional.hpp>

And through other includes Boost.Units.

I am not building a library nor is any of the statechart code in a
library, though the build process does say it creates a .lib with the
same name as the .exe I ask for but that also happens in debug. The
whole thing is in a header that is included by the .cpp file that
generates the .obj that causes the linker error. Again, debug builds
work perfectly well with the same flags that cause the problem in

Boost version is 1.42

Would like to know what's going on, how to correctly fix it, etc...


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at