[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [rtl] Can't use unistd.h in C++ realtime modules?



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