[antlr-interest] Re: Problem compiling in Visual C++ 7.1

Karp Dantax karpdantax at yahoo.com.br
Mon Jul 24 13:04:24 PDT 2006


ANTLR 2.7.6 in VC++ 7.1
-------------------------------------

In config.hpp:

# if ( _MSC_VER < 1320 )
# define NO_STATIC_CONSTS
# endif

In TokenStreamRewriteEngine.cpp:

#ifndef NO_STATIC_CONSTS
const size_t TokenStreamRewriteEngine::MIN_TOKEN_INDEX = 0;
const int TokenStreamRewriteEngine::PROGRAM_INIT_SIZE = 100;
#endif

  ----- Original Message ----- 
  From: Peter Palotas 
  To: antlr-interest at antlr.org 
  Sent: Monday, July 24, 2006 3:47 PM
  Subject: [antlr-interest] Re: Problem compiling in Visual C++ 7.1


  Just discovered that compiling version 2.7.5 with the exact same project settings seems to work just fine by the way. So it seems the problem was introduced in version 2.7.6?

  // Peter


  On 7/24/06, Peter Palotas <peter.palotas at gmail.com> wrote:
    Hi,

    I've been trying to compile antlr-2.7.6 in Visual C++ 7.1 (Part of Visual Studio .NET 2003), but the librarian creates a bunch of warnings about things being defined twice in the object files which are then replicated when trying to link to the generated library (see bottom of mail). 

    Any ideas on what to do to correct this? I simply made a new project, included all .cpp files from the lib\cpp\src\ directory, compiled as static library, single-threaded debug, and this is the result.

    The command-line options generated for compiling is: /Od /I "..\..\antlr- 2.7.6\lib\cpp" /D "_DEBUG" /D "_LIB" /D "_MBCS" /FD /EHsc /RTC1 /MLd /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /nologo /c /Wp64 /ZI /TP

    And for the librarian the not so interesting: /OUT:"..\..\lib/libantlrd.lib" /NOLOGO 

    Any help on this would be greatly appreciated.

    Sincerely, Peter


    The warnings from the librarian are:

    Creating library...
    Token.obj : warning LNK4006: "public: static int const antlr::Token::SKIP" (?SKIP@ Token at antlr@@2HB) already defined in TreeParser.obj; second definition ignored
    Token.obj : warning LNK4006: "public: static int const antlr::Token::EOF_TYPE" (?EOF_TYPE at Token@antlr@@2HB) already defined in TreeParser.obj ; second definition ignored
    Token.obj : warning LNK4006: "public: static int const antlr::Token::INVALID_TYPE" (?INVALID_TYPE at Token@antlr@@2HB) already defined in TreeParser.obj; second definition ignored
    Token.obj : warning LNK4006: "public: static int const antlr::Token::NULL_TREE_LOOKAHEAD" (?NULL_TREE_LOOKAHEAD at Token@antlr@@2HB) already defined in TreeParser.obj; second definition ignored
    Token.obj : warning LNK4006: "public: static int const antlr::Token::MIN_USER_TYPE" (?MIN_USER_TYPE@ Token at antlr@@2HB) already defined in TreeParser.obj; second definition ignored
    MismatchedTokenException.obj : warning LNK4006: "public: static int const antlr::MismatchedTokenException::NOT_SET" (?NOT_SET at MismatchedTokenException@antlr @@2HB) already defined in TreeParser.obj; second definition ignored
    MismatchedTokenException.obj : warning LNK4006: "public: static int const antlr::MismatchedTokenException::SET" (?SET at MismatchedTokenException@antlr @@2HB) already defined in TreeParser.obj; second definition ignored
    MismatchedTokenException.obj : warning LNK4006: "public: static int const antlr::MismatchedTokenException::NOT_RANGE" (?NOT_RANGE at MismatchedTokenException@antlr @@2HB) already defined in TreeParser.obj; second definition ignored
    MismatchedTokenException.obj : warning LNK4006: "public: static int const antlr::MismatchedTokenException::RANGE" (?RANGE at MismatchedTokenException@antlr @@2HB) already defined in TreeParser.obj; second definition ignored
    MismatchedTokenException.obj : warning LNK4006: "public: static int const antlr::MismatchedTokenException::NOT_TOKEN" (?NOT_TOKEN at MismatchedTokenException@antlr @@2HB) already defined in TreeParser.obj; second definition ignored
    MismatchedTokenException.obj : warning LNK4006: "public: static int const antlr::MismatchedTokenException::TOKEN" (?TOKEN at MismatchedTokenException@antlr @@2HB) already defined in TreeParser.obj; second definition ignored
    MismatchedCharException.obj : warning LNK4006: "public: static int const antlr::MismatchedCharException::NOT_SET" (?NOT_SET at MismatchedCharException@antlr @@2HB) already defined in NoViableAltForCharException.obj; second definition ignored
    MismatchedCharException.obj : warning LNK4006: "public: static int const antlr::MismatchedCharException::SET" (?SET at MismatchedCharException@antlr @@2HB) already defined in NoViableAltForCharException.obj; second definition ignored
    MismatchedCharException.obj : warning LNK4006: "public: static int const antlr::MismatchedCharException::NOT_RANGE" (?NOT_RANGE@ MismatchedCharException at antlr@@2HB) already defined in NoViableAltForCharException.obj; second definition ignored
    MismatchedCharException.obj : warning LNK4006: "public: static int const antlr::MismatchedCharException::RANGE" (?RANGE@ MismatchedCharException at antlr@@2HB) already defined in NoViableAltForCharException.obj; second definition ignored
    MismatchedCharException.obj : warning LNK4006: "public: static int const antlr::MismatchedCharException::NOT_CHAR" (?NOT_CHAR@ MismatchedCharException at antlr@@2HB) already defined in NoViableAltForCharException.obj; second definition ignored
    MismatchedCharException.obj : warning LNK4006: "public: static int const antlr::MismatchedCharException::CHAR" (?CHAR@ MismatchedCharException at antlr@@2HB) already defined in NoViableAltForCharException.obj; second definition ignored
    CharScanner.obj : warning LNK4006: "private: static int const antlr::CharScanner::NO_CHAR" (?NO_CHAR@ CharScanner at antlr@@0HB) already defined in NoViableAltForCharException.obj; second definition ignored
    CharScanner.obj : warning LNK4006: "public: static int const antlr::CharScanner::EOF_CHAR" (?EOF_CHAR at CharScanner@antlr @@2HB) already defined in NoViableAltForCharException.obj; second definition ignored



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060724/4b923bc1/attachment.html


More information about the antlr-interest mailing list