Fw: [antlr-interest] Compiling Simple grammar with Visual C++ 6 using ANTLR 2.7.5

denis, alexis adenis at bristol.ca
Tue Sep 13 07:17:42 PDT 2005


Sorry to bother everybody with this again but any help would be appreciated.

-----Original Message-----
From: denis, alexis [mailto:adenis at bristol.ca]
Sent: Wednesday, August 31, 2005 11:44 AM
To: 'antlr-interest at antlr.org'
Subject: [antlr-interest] Compiling Simple grammar with Visual C++ 6 using
ANTLR 2.7.5



Hello, 

I just wanted to mention first that the ANTLR library and the grammar
compile fine with ANTLR version 2.7.4. 

When compiling the ANTLR 2.7.5 C++ library, I had to change a few things.
The main problem was the following lines: 
1. std::min is not defined, had to change it to std::_MIN 
2. Visual C++ 6 doesn't handle the static const initialization: 
            static const size_t MIN_TOKEN_INDEX = 0; 
        static const char* DEFAULT_PROGRAM_NAME; 
        static const int PROGRAM_INIT_SIZE = 100; 
   I had a look in other files and there is a conditional compile for static
const that are replaced by enums. I did just that for the two ints but
couldn't for the constant char pointer. I redeclared the pointer char
pointer without const.

3. There were some methods returning void but were assigned a return value
and the compiler complained about that. I just removed the return
statements.

                void toStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const
{ 
                  return toStream( out, MIN_TOKEN_INDEX,
getTokenStreamSize()); 
                    } 
        changed to: 
                   void toStream( ANTLR_USE_NAMESPACE(std)ostream& out )
const { 
                   toStream( out, MIN_TOKEN_INDEX, getTokenStreamSize()); 
                    } 

Once I got the library to compile, I tried compiling a simple grammar and I
got the following errors: 

At compile time: 

MyExprParser.cpp 
MyExprParser.cpp(162) : error C2065: 'recover' : undeclared identifier 
relates to the line: 
        catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { 
                reportError(ex); 
                recover(ex,_tokenSet_5); 
        } 

I just create an empty macro for that function but then I get some link time
errors: 

main.obj : error LNK2001: unresolved external symbol "public: virtual void
__thiscall antlr::CharScanner::panic(void)"
(?panic at CharScanner@antlr@@UAEXXZ)

MyExprLexer.obj : error LNK2001: unresolved external symbol "public: virtual
void __thiscall antlr::CharScanner::panic(void)"
(?panic at CharScanner@antlr@@UAEXXZ)

main.obj : error LNK2001: unresolved external symbol "public: virtual void
__thiscall antlr::CharScanner::panic(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)"
(?panic at CharScanner@antlr@@UAEXABV?$bas

ic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@Z) 
MyExprLexer.obj : error LNK2001: unresolved external symbol "public: virtual
void __thiscall antlr::CharScanner::panic(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)" (?panic at CharScanner@antlr@@UAEXA

BV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@Z) 
MyExprLexer.obj : error LNK2001: unresolved external symbol "class
antlr::RefCount<class antlr::Token> antlr::nullToken"
(?nullToken at antlr@@3V?$RefCount at VToken@antlr@@@1 at A)

MyExprParser.obj : error LNK2001: unresolved external symbol "class
antlr::RefCount<class antlr::Token> antlr::nullToken"
(?nullToken at antlr@@3V?$RefCount at VToken@antlr@@@1 at A)

MyExprParser.obj : error LNK2001: unresolved external symbol "public:
virtual void __thiscall antlr::Parser::panic(void)"
(?panic at Parser@antlr@@UAEXXZ)

MyExprParser.obj : error LNK2001: unresolved external symbol "public:
__thiscall antlr::NoViableAltException::NoViableAltException(class
antlr::RefCount<class antlr::Token>,class std::basic_string<char,struct
std::char_traits<char>,class std::alloca

tor<char> > const &)"
(??0NoViableAltException at antlr@@QAE at V?$RefCount at VToken@antlr@@@1 at ABV?$basic_
string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@Z)

MyExprParser.obj : error LNK2001: unresolved external symbol "public: class
antlr::RefCount<class antlr::Token> __thiscall
antlr::TokenBuffer::LT(unsigned int)"
(?LT at TokenBuffer@antlr@@QAE?AV?$RefCount at VToken@antlr@@@2 at I@Z)

Debug/mytree_expr.exe : fatal error LNK1120: 6 unresolved externals 

Any help? 

Alexis 

----------------------------------------------------------------------
"Confidentiality Disclaimer:  This message and the documents attached is
intended for the addressee(s) only and may contain privileged, private or
confidential information.  Unauthorized review, disclosure, dissemination,
distribution, duplication or other  use of this information is strictly
prohibited.  If you have received this message in error, please notify the
sender immediately via telephone or return email.  Please, then delete the
original email and all copies from your system, servers, backups and
archives".
----------------------------------------------------------------------

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


More information about the antlr-interest mailing list