[prev in list] [next in list] [prev in thread] [next in thread]
List: antlr-interest
Subject: [antlr-interest] Compiling Simple grammar with Visual C++ 6 using
From: adenis () bristol ! ca (denis, alexis)
Date: 2005-08-31 9:43:50
Message-ID: A93344061C44D71199B60002B35EBA350245522B () mail ! bal
[Download RAW message or body]
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@CharScanner@antlr@@UAEXXZ)
MyExprLexer.obj : error LNK2001: unresolved external symbol "public: virtual
void __thiscall antlr::CharScanner::panic(void)"
(?panic@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@CharScanner@antlr@@UAEXABV?$bas
ic_string@DU?$char_traits@D@std@@V?$allocator@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@CharScanner@antlr@@UAEXA
BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
MyExprLexer.obj : error LNK2001: unresolved external symbol "class
antlr::RefCount<class antlr::Token> antlr::nullToken"
(?nullToken@antlr@@3V?$RefCount@VToken@antlr@@@1@A)
MyExprParser.obj : error LNK2001: unresolved external symbol "class
antlr::RefCount<class antlr::Token> antlr::nullToken"
(?nullToken@antlr@@3V?$RefCount@VToken@antlr@@@1@A)
MyExprParser.obj : error LNK2001: unresolved external symbol "public:
virtual void __thiscall antlr::Parser::panic(void)"
(?panic@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@antlr@@QAE@V?$RefCount@VToken@antlr@@@1@ABV?$basic_
string@DU?$char_traits@D@std@@V?$allocator@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@TokenBuffer@antlr@@QAE?AV?$RefCount@VToken@antlr@@@2@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:8080/pipermail/antlr-interest/attachments/20050831/4f4955e2/attachment.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic