[antlr-interest] problems on linking

Ric Klaren ric.klaren at gmail.com
Sat Feb 5 16:16:35 PST 2005


On Sat, 5 Feb 2005 15:33:58 -0800 (PST), Sheng Wang
<shengwang08 at yahoo.com> wrote:
> I run into some problems when I try to link the
> compiled files that generated by ANTLR.  I am using
> "Cpp" option. GCC version is 3.4.2.
> 
> g++ -g -o myparser *.o /usr/lib/libantlr.a
> /usr/lib/libantlr.a(BitSet.o)(.text+0xfa): In function
> `antlr::BitSet::BitSet(unsigned int)':
> : undefined reference to
> `std::__default_alloc_template<true, 0>::_S_force_new'
> /usr/lib/libantlr.a(BitSet.o)(.text+0x127): In
> function `antlr::BitSet::BitSet(unsigned int)':
> : undefined reference to
> `std::__default_alloc_template<true,
> 0>::_S_freelist_index(unsigned int)'
> /usr/lib/libantlr.a(BitSet.o)(.text+0x134): In
> function `antlr::BitSet::BitSet(unsigned int)':
> ....
> 
> Any insights?

- Verify your gcc installation is ok. If you got 3.4.2 installed in a
non default location it might happen that it picks up a wrong C++
library (from the default location of your distribution, there's a
number of --print-<sumthin> options you can use to help checking this,
together with the ldd command).
- Verify that you've compiled libantlr.a with the same compiler as
you're compiling your project. (or at least with a version that's ABI
compatible)

Hope this helps,

Ric


More information about the antlr-interest mailing list