[SATLUG] Linux programming question
weaver at merold.net
Thu Jul 14 15:28:46 CDT 2005
On Thursday 14 July 2005 10:30 am, David Salisbury wrote:
> So I'm trying to compile ClanLib, and getting an error, and after
> testing a few things have narrowed my problem down to a particular
> #include line and wrote a quick little C program to test my theory.
> If I compile that with gcc, it compiles just fine, no complaints.
> HOWEVER, if I compile it with g++ or c++ I get the following error:
> In file included from /usr/include/linux/spinlock.h:6,
> from /usr/include/linux/module.h:11,
> from /usr/include/linux/joystick.h:33,
> from dave.c:2:
> /usr/include/asm/system.h:244: error: syntax error before `new'
> Why would g++ or c++ have a problem compiling this, and not gcc? It
> must have something to do with C++ handling this all differently, but
> I'm not sure how (although a little googling seemed to point to
> something regarding user space and kernel space but I am still at a
> loss at the moment). Anyway, it's a problem, because ClanLib is
> compiling with g++ and breaks down when it gets to the point where it
> #includes the <linux/joystick.h> headers.
It compiled fine for me (gcc 4 & kernel 2.6.11).
You're getting the error perhaps because they're using "new" as a variable
name. That's fine in C, but it's a reserved word in C++.
You could try upgrading your kernel headers if at all possible (since the
current ones seem ok). Also, just check to see if ClanLib requires any
particular kernel version.
Nothing is ever a total loss; it can always serve as a bad example.
More information about the SATLUG