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:

http://old.nabble.com/-statechart-LNK2001-Error-on-VC-8.0-
td11748021.html

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:

http://thread.gmane.org/gmane.comp.lib.boost.user/23065

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
library.

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:

#define BOOST_PARAMETER_MAX_ARITY 20

#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
release.

Boost version is 1.42

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

-- 
http://crazyeddiecpp.blogspot.com/

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net