Compile error when including "timer.h" from c++ source file

Yaniv Weizman <[email protected]> Thu, 14 Oct 2004 08:55:49 +0200
Newsgroups gmane.linux.redhat.devel
Organization Vimlicity
Message-ID <[email protected]>
 

Hello,

We are developing a timer wheel mechanism for our Linux application in c++
environment (Eclipse).

However, when including the file "timer.h" file from the Linux library,
there is a compile error indicating a problem of using the word "new" in the
file "list.h" (the compiler identify it as a key work in c++ instead of a
function's parameter name):

 

In file included from
/cygdrive/c/cygwin/usr/cross-linux/bin/../lib/gcc/i686-pc-linux-gnu/3.4.1/..
/../../../i686-pc-linux-gnu/sys-include/linux/timer.h:17,

                 from ../InfraTimerWheel.h:26,

                 from ../InfraTimerWheel.cc:15:

/cygdrive/c/cygwin/usr/cross-linux/bin/../lib/gcc/i686-pc-linux-gnu/3.4.1/..
/../../../i686-pc-linux-gnu/sys-include/linux/list.h:37: error: expected `,'
or `...' before "new"

 

Line 37 In "list.h":

 

static __inline__ void __list_add(struct list_head * new,

            struct list_head * prev,

            struct list_head * next)

 

We tried to solve it by including "timer.h" in the following manner, but it
did not work:

 

extern "C" {

#undef __cplusplus

  #include <linux/types.h>

  #include <linux/timer.h>

#define __cplusplus

} 

 

Any suggestions?

_______________________________________________
Redhat-devel-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/redhat-devel-list