[antlr-interest] Antlr-2.7.6 with Visual Studio 8.0
Mark Kattenbelt
mark.kattenbelt at gmail.com
Tue Mar 14 02:40:59 PST 2006
Hello,
I've been trying to compile a dll of antlr 2.7.6 in Visual Studio 2005,
so far unsuccessfully.
In mingw, I manage to compile it fine, only took a few minutes to set
up! I use the following settings for VS:
Include dir: "lib\cpp"
Preprocessor: WIN32;_DEBUG;_WINDOWS;_USRDLL;ANTLR_EXPORTS
Run-time library: Multi-treaded debug.
Create precompiled headers: yes.
Function level linking: yes.
RTTI: yes.
Which results into compiling with the following line:
/O2 /I "lib\cpp" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D
"ANTLR_EXPORTS" /D "_WINDLL" /FD /EHsc /MTd /Gy /Yc
/Fp"Debug\antlr-2.7.6.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /nologo /c
/TP /errorReport:prompt
And linking with:
/OUT:"d:\Fmt\antlr-2.7.6\Debug\antlr-2.7.6.dll" /NOLOGO /DLL /MANIFEST
/MANIFESTFILE:"Debug\antlr-2.7.6.dll.intermediate.manifest"
/ASSEMBLYDEBUG /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
Now this fails during the linking stage, in particular it keeps finding
symbols that are defined in multiple places:
ASTFactory.obj : error LNK2005: "class std::basic_istream<char,struct
std::char_traits<char> > & __cdecl antlr::eatwhite(class
std::basic_istream<char,struct std::char_traits<char> > &)"
(?eatwhite at antlr@@YAAAV?$basic_istream at DU?$char_traits at D@std@@@std@@AAV23@@Z)
already defined in ANTLRUtil.obj
ASTFactory.obj : error LNK2005: "class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > __cdecl
antlr::read_string(class std::basic_istream<char,struct
std::char_traits<char> > &)" ...
I have tried to compile without precompiled headers, because I do not
see the need for them, this results in:
MismatchedCharException.obj : error LNK2005: "public: static int const
antlr::MismatchedCharException::CHAR"
(?CHAR at MismatchedCharException@antlr@@2HB) already defined in
CharScanner.obj
MismatchedCharException.obj : error LNK2005: "public: static int const
antlr::MismatchedCharException::NOT_CHAR"
(?NOT_CHAR at MismatchedCharException@antlr@@2HB) already defined in
CharScanner.obj
MismatchedCharException.obj : error LNK2005: "public: static int const
antlr::MismatchedCharException::RANGE"
(?RANGE at MismatchedCharException@antlr@@2HB) already defined in
CharScanner.obj
Clearly I am doing something wrong, and the settings need tweaking. Has
anyone here managed to build antlr (2.7.6?) with Visual Studio (8.0?).
If so could you please share your settings? Any help is appreciated.
Also, trying to compile it into a static library does not offer any
relief, the errors still persist.
Cheers,
Mark Kattenbelt
More information about the antlr-interest
mailing list