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

Re: tcgetattr

> From: "Nikolaus H. Krug" <goethe@xxxxxxx.at>
> Date: Thu, 28 Sep 2000 16:49:25 +0200

> (undefined reference to `_tcgetattr__FiP7termios)
> How is it possible to set the baudrate e.g. of /dev/ttyS0 without these
> functions? Or is it necessary to include another headerfile?

It looks like you did the following in a C++-file:

#include <termios.h>

The function tcgetattr etc. are C functions, so you need to
include the declarations as having C linkage, or the function
names referred to will have the names "mangled".  So do this

extern "C"
#include <termios.h>

(Some header files are C++-aware, and have #ifdef __cplusplus
around the extern "C" bits.  Apparently not the case for

brgds, H-P