Hello all,
        I'm writing a simple realtime module to learn how to compile and use C++ 
code. I include the files that I'm using:
        - rtmatrix.h and rtmatrix.cpp will define the class that I want to handle, 
at the moment they just define the A and C classes of the cpp example.
        - rtmodule.cpp is a realtime module generated by the next release of DSLib, 
v1.3. It's generated from an empty dynamic system so it does nothing.
        - Makefile is a slight modification of cpp-example's makefile, which 
compiles rtmodule.cpp instead of hello.cpp and includes rtmatrix.o in linking.
        All this compiles fine, the problem is I get the following error when 
installing app.o:

Now start the real-time tasks  module
Type <return> to continue

app.o: unresolved symbol rtl_printf__FPCce
make: *** [test] Error 1

        rtmatrix.cpp includes rtl_printf.h and is compiled the same way than 
rtmodule.cpp (which I can't understand as I said in my last posting). Do you 
know what the problem is?.
        Regards,
        Ivan Martinez
class A {
protected:
	int a;
public:
	virtual void print()=0;
	A();
	virtual ~A();
};

class B : public A
{
public:
	B();
	~B();
	virtual void print();
};
#include "rtmatrix.h"
#include <rtl_printf.h>

A::A()
{
	a = 1;
	rtl_printf("initializing A\n");
}

A::~A()
{
	rtl_printf("uninitializing A\n");
}

B::B()
{
	a = 1;
	rtl_printf("initializing B\n");
}

B::~B()
{
	rtl_printf("uninitializing B\n");
}

void B::print()
{
	rtl_printf("B::print: %d\n", a);
}
#include "rtmatrix.h"
#include <rtl_cpp.h>
hrtime_t start_time;
char run;
void system_vars_init(void)
{
}
void start_execution(void)
{
  system_vars_init();
  run = 1;
  start_time = gethrtime();
}
void stop_execution(void)
{
  run = 0;
}
int init_module(void)
{
  __do_global_ctors_aux();
  start_execution();
  return 0;
}
void cleanup_module(void)
{
  stop_execution();
  __do_global_dtors_aux();
}
all: app.o rtl_cpp.o rtmatrix.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 rtmatrix.o
	echo $(LD)
	echo $(CRTBEGIN)
	echo $(CRTEND)
	$(LD) -r -o app.o $(CRTBEGIN) rtmodule.o rtmatrix.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

Reply via email to