Hi, I am trying to compile pdf-filter to support printing for mini2440. I ran to the strange error when compiling with arm-unknown-linux-uclibcgnueabi-g++ The error occur at the line of putchar function sudo /home/bao/work/buildroot/output/staging/usr/bin/arm-unknown-linux-uclibcgnueabi- g++ --sysroot=/home/bao/work/buildroot/output/staging -Ioprs -Iopvp -I../opvp -I../.. -I.. -D_CUPS_SOURCE -I/usr/include/poppler -I/usr/include/poppler -I/usr/include/poppler -DPDFTOPDF -pipe -O2 -mtune=arm920t -march=armv4t -mabi=aapcs-linux -I/home/bao/work/buildroot/output/staging/usr/include -I/home/bao/work/buildroot/output/staging/include -c test.cxx In file included from test.cxx:1: test.h:14: error: expected identifier before '(' token test.h:14: error: expected identifier before '(' token test.cxx:18: error: expected unqualified-id before '(' token Below is the test.h and test.cxx file: test.h: #ifndef _TEST_H_ #define _TEST_H_ //#include "goo/gtypes.h" //#include <config.h> #include <stdio.h> class test { public: test(); ~test(); int putchar(char c); }; #endif And the test.cxx file: #include "test.h" //#include <stdarg.h> //#include <string.h> //#include <Error.h> /* Constructor */ test::test() { } test::~test() { } int test::putchar(char c) { } Can any one give me some advice? Thank you
error: expected identifier before '(' token
<error: expected identifier before '(' token> in Google didn't help? Some of them were interesting reading.
Google doesn't help ;). Just change putchar to some other name (putchar is from libc). I change to put_char and compile fine ;). marek
Thank Marek, I changed before as a work around. The problem is this function is used a lot in other modules, so I have to change them all. Is there another way to fix it? (Rebuild the compiler, change the compile flag, etc). Can it be considered as a bug of gcc that should be fixed. Regards, BAO
Yes, the putchar is the standard name. But I can compile this code with native g++ without error. And this function is an override function in this class, so it should not be a problem.