[antlr-interest] Newbie: C++ lib build errors

me 262 me262c at gmail.com
Tue Mar 27 17:40:37 PDT 2007


Thanks Ric. I was able to build the static library on 2.7.7 without
error with VC7.

However, I got a lot of link errors when building the calc example.
Any suggestions?

Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to
'/INCREMENTAL:NO' specification
antlrCPP.lib(MismatchedTokenException.obj) : error LNK2005: "public:
static int const antlr::MismatchedTokenException::NOT_SET"
(?NOT_SET at MismatchedTokenException@antlr@@2HB) already defined in
CalcTreeWalker.obj
antlrCPP.lib(MismatchedTokenException.obj) : error LNK2005: "public:
static int const antlr::MismatchedTokenException::SET"
(?SET at MismatchedTokenException@antlr@@2HB) already defined in
CalcTreeWalker.obj
antlrCPP.lib(MismatchedTokenException.obj) : error LNK2005: "public:
static int const antlr::MismatchedTokenException::NOT_RANGE"
(?NOT_RANGE at MismatchedTokenException@antlr@@2HB) already defined in
CalcTreeWalker.obj
antlrCPP.lib(MismatchedTokenException.obj) : error LNK2005: "public:
static int const antlr::MismatchedTokenException::RANGE"
(?RANGE at MismatchedTokenException@antlr@@2HB) already defined in
CalcTreeWalker.obj
antlrCPP.lib(MismatchedTokenException.obj) : error LNK2005: "public:
static int const antlr::MismatchedTokenException::NOT_TOKEN"
(?NOT_TOKEN at MismatchedTokenException@antlr@@2HB) already defined in
CalcTreeWalker.obj
antlrCPP.lib(MismatchedTokenException.obj) : error LNK2005: "public:
static int const antlr::MismatchedTokenException::TOKEN"
(?TOKEN at MismatchedTokenException@antlr@@2HB) already defined in
CalcTreeWalker.obj
antlrCPP.lib(CharScanner.obj) : error LNK2005: "private: static int
const antlr::CharScanner::NO_CHAR" (?NO_CHAR at CharScanner@antlr@@0HB)
already defined in CalcLexer.obj
antlrCPP.lib(CharScanner.obj) : error LNK2005: "public: static int
const antlr::CharScanner::EOF_CHAR" (?EOF_CHAR at CharScanner@antlr@@2HB)
already defined in CalcLexer.obj
antlrCPP.lib(Token.obj) : error LNK2005: "public: static int const
antlr::Token::SKIP" (?SKIP at Token@antlr@@2HB) already defined in
CalcTreeWalker.obj
antlrCPP.lib(Token.obj) : error LNK2005: "public: static int const
antlr::Token::EOF_TYPE" (?EOF_TYPE at Token@antlr@@2HB) already defined
in CalcTreeWalker.obj
antlrCPP.lib(Token.obj) : error LNK2005: "public: static int const
antlr::Token::INVALID_TYPE" (?INVALID_TYPE at Token@antlr@@2HB) already
defined in CalcTreeWalker.obj
antlrCPP.lib(Token.obj) : error LNK2005: "public: static int const
antlr::Token::NULL_TREE_LOOKAHEAD"
(?NULL_TREE_LOOKAHEAD at Token@antlr@@2HB) already defined in
CalcTreeWalker.obj
antlrCPP.lib(Token.obj) : error LNK2005: "public: static int const
antlr::Token::MIN_USER_TYPE" (?MIN_USER_TYPE at Token@antlr@@2HB) already
defined in CalcTreeWalker.obj
antlrCPP.lib(MismatchedCharException.obj) : error LNK2005: "public:
static int const antlr::MismatchedCharException::NOT_SET"
(?NOT_SET at MismatchedCharException@antlr@@2HB) already defined in
CalcLexer.obj
antlrCPP.lib(MismatchedCharException.obj) : error LNK2005: "public:
static int const antlr::MismatchedCharException::SET"
(?SET at MismatchedCharException@antlr@@2HB) already defined in
CalcLexer.obj
antlrCPP.lib(MismatchedCharException.obj) : error LNK2005: "public:
static int const antlr::MismatchedCharException::NOT_RANGE"
(?NOT_RANGE at MismatchedCharException@antlr@@2HB) already defined in
CalcLexer.obj
antlrCPP.lib(MismatchedCharException.obj) : error LNK2005: "public:
static int const antlr::MismatchedCharException::RANGE"
(?RANGE at MismatchedCharException@antlr@@2HB) already defined in
CalcLexer.obj
antlrCPP.lib(MismatchedCharException.obj) : error LNK2005: "public:
static int const antlr::MismatchedCharException::NOT_CHAR"
(?NOT_CHAR at MismatchedCharException@antlr@@2HB) already defined in
CalcLexer.obj
antlrCPP.lib(MismatchedCharException.obj) : error LNK2005: "public:
static int const antlr::MismatchedCharException::CHAR"
(?CHAR at MismatchedCharException@antlr@@2HB) already defined in
CalcLexer.obj
.\Debug/calc.exe : fatal error LNK1169: one or more multiply defined
symbols found

On 3/27/07, Ric Klaren <ric.klaren at gmail.com> wrote:
> Hi,
>
> On 3/27/07, me 262 <me262c at gmail.com> wrote:
> > c:\antlr\antlr-2.7.6\lib\cpp\src\dll.cpp(24) : fatal error C1189:
> > #error :  "DLL Build not supported on old MSVC's"
>
> This tells you that you can't build the support library into a DLL on
> an old Microsoft compiler (version 6 and below). E.g. just compile a
> static library. Also make sure to use the same linking settings for
> the library and the project you're using the library in (e.g. the
> multithreaded etc. settings)
>
> > TokenStreamRewriteEngine.cpp
> > c:\antlr\antlr-2.7.6\lib\cpp\src\tokenstreamrewriteengine.cpp(22) :
> > error C2888: 'enum MIN_TOKEN_INDEX' : symbol cannot be defined within
> > namespace 'antlr'
> > c:\antlr\antlr-2.7.6\lib\cpp\src\tokenstreamrewriteengine.cpp(22) :
> > fatal error C1903: unable to recover from previous error(s); stopping
> > compilation
> > Error executing cl.exe.
>
> This should be fixed in the 2.7.7 release.
>
> Cheers,
>
> Ric
>


More information about the antlr-interest mailing list