[antlr-interest] C runtime linking error?

Yves Weißig weissig at rbg.informatik.tu-darmstadt.de
Mon Mar 19 23:15:19 PDT 2012


Hi again,

I fixed it by myself. The library has to go at the end:
gcc -I../src ../src/RtfLexer.cpp ../src/RtfParser.cpp -lantlr3c
made the trick and worked.

Best regards
Yves

Am 19.03.2012 12:58, schrieb Yves Weißig:
> Hi,
> 
> sorry to bump this topic, but my problem is still present.
> I re-isntalled the antlr3.4c runtime and re-generated the C-files and
> have still no luck, even this compilation fails with the "undefined
> reference" errors:
> gcc -lantlr3c -I../src ../src/RtfLexer.cpp ../src/RtfParser.cpp
> So even stripping it down to C and without my custom code I run into the
> same problems.
> The libraries are in the correct spot:
> foo at bar:~$ ll /usr/local/lib/
> total 304
> drwxr-xr-x  3 root root    4096 2012-03-19 12:40 ./
> drwxr-xr-x 10 root root    4096 2011-10-12 16:27 ../
> -rw-r--r--  1 root root  154132 2012-03-19 12:40 libantlr3c.a
> -rwxr-xr-x  1 root root     929 2012-03-19 12:40 libantlr3c.la*
> -rwxr-xr-x  1 root root  136864 2012-03-19 12:40 libantlr3c.so*
> drwxrwsr-x  4 root staff   4096 2011-10-12 16:27 python2.7/
> I guess gcc and g++ find the library, otherwise they would throw an
> error. What else maybe wrong? Am I missing some packages/dependencies?
> 
> Best regards
> Yves
> 
> Am 15.03.2012 12:49, schrieb Yves Weißig:
>> Hi, thanks for the hint... don't know if I get that right:
>> ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
>> throws the error and was generated that way, something wrong with my
>> generator? I didn't edit the files...
>>
>> Am 15.03.2012 12:19, schrieb Gavin Lambert:
>>> At 22:19 15/03/2012, Yves Weißig wrote:
>>>> I'm trying to compile and link an ANTLR C backend with some C++
>>>> code which I wrote.
>>> [...]
>>>> /tmp/ccnHhg86.o: In function `RtfLexerNewSSD':
>>>> RtfLexer.cpp:(.text+0xb0): undefined reference to
>>>> `antlr3LexerNewStream'
>>>
>>> Most likely, you're missing some extern "C" blocks.
>>>
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list