[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [rtl] Can't use unistd.h in C++ realtime modules?
Thank you,
I need this to add C++ support to my Dynamic Systems Library (dslib.sf.net).
It wouldn't be nice to ask users to modify RTLinux' header files, and I
prefer not to complicate things by making the library generate aditional
header files.
So, is there a way of including "unistd.h" in the realtime module?. Using
the following doesn't seem to make any difference:
extern "C" {
#incude <unistd.h>
}
Regards,
Ivan
On Friday 02 November 2001 08:42, David Hamilton wrote:
> Ivan,
> The rtl headers should but don't have
> #ifdef __cplusplus
> extern "C"
> #endif
> at the top.
> Therefore you have to make the extern "C" declaration yourself.
> I just use the example header (from examples/cpp) rtl_cpp.h and added
> #define <unistd.h>
> to it.
> Note: I moved the new and delete functions to another header
> (rtl_cpp_fun.h) so I could include rtl_cpp.h in multiple .cpp files, and
> include
> rtl_cpp_fun.h in just one (to avoid multiple copies of the function being
> linked together).
> David
>
> -----Original Message-----
> From: Ivan Martinez [mailto:im@iau.dtu.dk]
> Sent: 01 November 2001 15:19
> To: RTLinux mailing list
> Subject: [rtl] Can't use unistd.h in C++ realtime modules?
>
>
> Hello all,
> The first line of my C++ realtime module is:
>
> #include <unistd.h>
>
> Which produces the following compilation errors:
>
> In file included from /usr/src/rtlinux-3.1/linux/include/linux/wait.h:14,
> from /usr/src/rtlinux-3.1/linux/include/linux/fs.h:12,
> from /usr/src/rtlinux-3.1/include/rtl_posixio.h:13,
> from /usr/src/rtlinux-3.1/include/posix/unistd.h:17,
> from rtmodule.cpp:1:
> /usr/src/rtlinux-3.1/linux/include/linux/list.h:35: parse error before
> `new' /usr/src/rtlinux-3.1/linux/include/linux/list.h: In function `void
> __list_add
> (...)':
> /usr/src/rtlinux-3.1/linux/include/linux/list.h:39: `next' undeclared
> (first
>
> use this function)
> /usr/src/rtlinux-3.1/linux/include/linux/list.h:39: (Each undeclared
> identifier is reported only once
> for each function it appears in.)
> /usr/src/rtlinux-3.1/linux/include/linux/list.h:39: parse error before `;'
> /usr/src/rtlinux-3.1/linux/include/linux/list.h:42: `prev' undeclared
> (first
>
> use this function)
> ...
>
> I use the attached Makefile. Do you know what's wrong?.
> BTW, I don't really know which C and C++ libraries I can link in
> realtime
> modules, could anybody tell me where to find info about that?.
> Thank you,
> Ivan Martinez
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org