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

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
all: app.o rtl_cpp.o testclass.o

include /usr/src/rtlinux-3.1/rtl.mk

CRTBEGIN=`g++ -print-file-name=crtbegin.o` 
CRTEND=`g++ -print-file-name=crtend.o`

app.o: rtmodule.o testclass.o
	echo $(LD)
	echo $(CRTBEGIN)
	echo $(CRTEND)
	$(LD) -r -o app.o $(CRTBEGIN) rtmodule.o testclass.o $(CRTEND)

clean:
	rm -f *.o

test: all
	@echo "This is a simple RTLinux program"
	@echo "First we remove any existing rtl-modules"
	@echo "You may see error warnings from \"make\" - ignore them"
	@echo "Type <return> to continue"
	@read junk
	-rmmod sound
	-rmmod rt_process
	-rmmod frank_module
	-rmmod rtl_cpp
	(cd $(RTL_DIR); scripts/rmrtl)
	@echo "Now insert the fifo and scheduler"
	@echo "Type <return> to continue"
	@read junk
	(cd $(RTL_DIR); scripts/insrtl)
	@echo "Now insert the C++ support module"
	insmod rtl_cpp.o
	@echo "Now start the real-time tasks  module"
	@echo "Type <return> to continue"
	@read junk
	@insmod app.o
	@sleep 3
	@echo "Now let's stop the application"
	@echo "Type <return> to finish"
	@read junk
	@rmmod app
	@rmmod rtl_cpp

include $(RTL_DIR)/Rules.make