Skip to contentSkip to conversation

undefined reference to `rt_printf(char const*, ...)'

Xenomai-help Dennis Nguyen 2 participants 3 messages Dec 5, 2007

lore
Share & tools
lore
#0 lore raw

Hello all,

I got the "undefined reference to rt_printf" function when I called rt_printf in my application. I included the header #include <rtdk.h> in the source file and -L /usr/xenomai/lib -lrtdk -lpthread-rt in the makefile. I'm using kernel i386 2.6.23.9 and xenomai 2-4rc7. I have the rtdk.h include file in /usr/xenomai/include and librtdk.so in the /usr/xenomai/lib. What am I missing?

Thanks in advance

#1 lore raw
Quoted 9 lines · Dennis Nguyen

Hello all,

I got the "undefined reference to rt_printf" function when I called rt_printf in my application. I included the header #include <rtdk.h> in the source file and -L /usr/xenomai/lib -lrtdk -lpthread-rt in the makefile. I'm using kernel i386 2.6.23.9 and xenomai 2-4rc7. I have the rtdk.h include file in /usr/xenomai/include and librtdk.so in the /usr/xenomai/lib.
What am I missing?

Does the attached patch help ?

Signature · 1 line
                                               Gilles Chanteperdrix
rtdk.h +8 -0
Index: include/rtdk.h
===================================================================
@@ -44,6 +44,10 @@
 #include <stdio.h>
 #include <stdarg.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
 int rt_vfprintf(FILE *stream, const char *format, va_list args);
 int rt_vprintf(const char *format, va_list args);
 int rt_fprintf(FILE *stream, const char *format, ...);
@@ -54,6 +58,10 @@
 void rt_print_auto_init(int enable);
 const char *rt_print_buffer_name(void);
 
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
 #endif /* !KERNEL */
 
 #endif /* !_RTUTILS_H */
#2 lore raw
Quoted 11 lines · Gilles Chanteperdrix
Quoted 9 lines · Dennis Nguyen

Hello all,

I got the "undefined reference to rt_printf" function when I called rt_printf in my application. I included the header #include <rtdk.h> in the source file and -L /usr/xenomai/lib -lrtdk -lpthread-rt in the makefile. I'm using kernel i386 2.6.23.9 and xenomai 2-4rc7. I have the rtdk.h include file in /usr/xenomai/include and librtdk.so in the /usr/xenomai/lib.
What am I missing?

Quoted 2 lines

Does the attached patch help ?

Thanks Gilles,
Yes, the patch helped. My application is a cpp file. Dennis