Download the examples zip form the download page and copy the driver code from the examples in the C subdirectories. You are just setting up includes incorrectly I think as the compiler thinks your variable is an integer.
Jim On Sep 18, 2009, at 7:06 AM, Stefan Oestreicher <[email protected]> wrote: > Hi, > > I recently started playing around with antlr and first of all I have > to > say that it's a really awesome tool. Great work, thanks! > Now that I got a small and simple working grammar I'd like to write a > small C++ (I need to use LLVM eventually) program that processes an > input file and just dumps the AST to stdout, so I looked into the C > examples but unfortunately I ran into a compiler problem, probably due > to my limited experience with C/C++. > The compiler complains that ISO C++ forbids integer/pointer comparison > at the NULL pointer check: > > fileName = (pANTLR3_UINT8)argv[1]; > input = antlr3AsciiFileStreamNew(fileName); > > if (input == NULL) { // forbidden integer/pointer comparison - huh? > printf("Failed to open %s", fileName); > return -1; > } > > If I compile as C it issues more or less the same message but then > it's > only a warning. However when I run the program it segfaults in the > lexer > factory (MyGrammarLexerNew). This also happens when I just remove the > null pointer check when compiling as C++, however input is most > certainly not null. > > I'm compiling on windows xp using the mingw toolchain (gcc 3.4.5) > but I > verified that the same problem exists on debian etch with gcc 4.1.2. > My > ANTLR and runtime version is 3.1.3. > > I'd appreciate any help as I couldn't find any hint on what I'm doing > wrong. > > thanks, > > Stefan > > > > > 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
