[antlr-interest] Compile & link to DLL with mingw (code::blocks)

Mark Kattenbelt mark.kattenbelt at gmail.com
Sun Nov 20 07:34:53 PST 2005


Hello,

I have been using ANTLR as a static lib in my c++ project for a while. 
This works great but I'd like to make a dynamic library instead. I 
encounter problems linking to my own antlr.dll.

I use Code::Blocks as a IDE, with the compiler GNU GCC (mingw). I can 
compile an antlr.dll by doing the following:

I included all files in \lib\cpp\src and all headers from 
\lib\cpp\antlr. I included the \lib\cpp too. I used the following 
defines: WIN32, NDEBUG, _WINDOWS, _USRDLL, ANTLR_EXPORTS, 
ANTLR_CXX_SUPPORTS_NAMESPACE.

And I compile this to a antlr.dll file. This all goes ok and without a 
warning or error.

Now when I want to compile my own program, I get linker errors. I have 
the following settings:

I defined ANTLR_IMPORTS, ANTLR_CXX_SUPPORTS_NAMESPACE. Included the 
antlr headers in \lib\cpp and pointed the linker to the antlr root. I 
also specify linker option -lantlr.

Now the errors I get are because GNU GCC fails to auto import data or 
something similar. I probably am doing something stupid but I cannot 
that noone else has had the same problems. I would appreciate the help!

The link errors I get are at: http://pastebin.ca/29604

I have tried to disable autoimport, tried to specify 
--enable-runtime-pseudo-relocs and a bunch of other things. I just 
cannot get it to work!

Please help,

Mark


More information about the antlr-interest mailing list