[antlr-interest] Making c target work with c++

Loring Craymer lgcraymer at yahoo.com
Tue Jun 12 08:10:48 PDT 2007


This is a language issue; C++ mangles names unless
they are declared as being "C" items.

Change your prototype to 
extern "C" CParser_Ctx_struct *CParserNew(struct
ANTLR3_COMMON_TOKEN_STREAM_struct *);

and make similar changes as required.

--Loring

--- v r <soth1985 at yahoo.com> wrote:

> When I compile an example from \examples-v3\C\C as c
> code everything works fine , but if i ish to compile
> it as c++(i just rename main.c to main.cpp ) i get
> errors
>   Error 4 error LNK2019: unresolved external symbol
> "struct CParser_Ctx_struct * __cdecl
> CParserNew(struct ANTLR3_COMMON_TOKEN_STREAM_struct
> *)"
>
(?CParserNew@@YAPAUCParser_Ctx_struct@@PAUANTLR3_COMMON_TOKEN_STREAM_struct@@@Z)
> referenced in function _main main.obj
> Error 5 error LNK2019: unresolved external symbol
> "struct ANTLR3_COMMON_TOKEN_STREAM_struct * __cdecl
> antlr3CommonTokenStreamSourceNew(unsigned int,struct
> ANTLR3_TOKEN_SOURCE_struct *)"
>
(?antlr3CommonTokenStreamSourceNew@@YAPAUANTLR3_COMMON_TOKEN_STREAM_struct@@IPAUANTLR3_TOKEN_SOURCE_struct@@@Z)
> referenced in function _main main.obj
> Error 6 error LNK2019: unresolved external symbol
> "struct CLexer_Ctx_struct * __cdecl CLexerNew(struct
> ANTLR3_INPUT_STREAM_struct *)"
>
(?CLexerNew@@YAPAUCLexer_Ctx_struct@@PAUANTLR3_INPUT_STREAM_struct@@@Z)
> referenced in function _main main.obj
> Error 7 error LNK2019: unresolved external symbol
> "struct ANTLR3_INPUT_STREAM_struct * __cdecl
> antlr3AsciiFileStreamNew(unsigned char *)"
>
(?antlr3AsciiFileStreamNew@@YAPAUANTLR3_INPUT_STREAM_struct@@PAE at Z)
> referenced in function _main main.obj
> Error 8 fatal error LNK1120: 4 unresolved externals
> C:\antlr-3.0\examples-v3\examples-v3\C\Debug\C.exe 1
>   so i wonder how to make all this work.
> 
>        
> ---------------------------------
> 
> ÷Ù ÕÖÅ Ó Yahoo!? éÓÐÙÔÁÊÔÅ ÏÂÎÏ×ÌÅÎÎÕÀ É ÕÌÕÞÛÅÎÎÕÀ.
> Yahoo! ðÏÞÔÕ!



       
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting 


More information about the antlr-interest mailing list