[antlr-interest] Need help getting the Antlr C runtime to link into test app.

Jim Idle jimi at temporal-wave.com
Thu Dec 9 06:57:39 PST 2010


You do not need to flag it as extern C, that is already done. Other than that, there is not enough information here, such as your .g file, the command lines you are using and so on.

It does work, but you should base your driver program around the C examples.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Jeffrey Newman
> Sent: Thursday, December 09, 2010 4:16 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Need help getting the Antlr C runtime to link
> into test app.
> 
> Hi,
> 
> I'm trying to bring up a C++/C development environment for Antlr.
> 
> I have this same problem with 3.2 and the 3.3 snapshot.
> 
> The error is expected unqualified-id before ')' token in antlr3l3xer.h
> 105 (the line below).
> 
> /** Pointer to a function that constructs a new token from the lexer
> stored information */
> pANTLR3_COMMON_TOKEN	(*emit)		    (struct ANTLR3_LEXER_struct
> * lexer);
> 
> 
> I build the source with ./configure --enable-64bit.
> Then installed (as root). This seemed to go fine.
> 
> I didn't see a test in the install.
> 
> I built a "treeparser.h" from all of the h files. (attached)
> 
> Here is the source file with the extern "C"...
> 
> #include <iostream>
> #include "AntlrApp.h"
> extern "C" {
> #include "treeparser.h"
> }
> AntlrApp::AntlrApp(int & argc, char ** argv)
> : QCoreApplication(argc, argv)
> {
> }
> int AntlrApp::exec()
> {
> std::cout << "Hello World";
> antlrCTest();
> exit();
> }
> void AntlrApp::antlrCTest()
> {
> }
> 
> When I comment out the offending line, the source complies.
> I really don't expect it to work.
> 
> Any help getting this resolved would appreciated.
> 
> thanks
> 
> Jeffrey




More information about the antlr-interest mailing list