[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [rtl] C++ compiling problem
Addendum to my previous post regarding not being able to compile the rtl
program examples/cpp.
I was using gcc/g++ version 2.95.3 (which successfully compiled the kernel).
I have just tried using the RedHat 7.1 gcc/g++ 2.96 compiler, and it
successfully compiled the c++ example (though it had failed to compile the
kernel).
This is a pain. I need to get the compiler version generally used by
RTLinux. I've heard mention of kgcc. Is this the best version to use?
Is this how it is referred to on the gnu ftp downloads?
David
-----Original Message-----
From: David Olofson [mailto:david.olofson@reologica.se]
Sent: 10 October 2001 19:26
To: rtl@fsmlabs.com
Subject: Re: [rtl] C++ compiling problem
On Wednesday 10 October 2001 19:22, David Hamilton wrote:
> I tried writing some simple apps in C++, and the compiler produces
> errors. This can be re-produced by simply renaming the hello.c example
> hello.cpp and trying to compile.
> There is something about conflict between C and C++ linkage in linux
> kernel headers.
> Anybody got any ideas.
> Is there a general problem developing RTLinux apps in C++ !???
You must tell the compiler that the kernel headers are written in C by
putting 'extern "C" {...}' around the #include directives. (Or the C++
compiler will assume that the function prototypes are to be interpreted
as C++, which results in different symbol names and possibly even
different calling conventions.)
//David Olofson --- Programmer, Reologica Instruments AB
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------------> http://www.linuxdj.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`-------------------------------------> http://olofson.net -'
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/