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

Re: Include files?



> From: Adam Felson <afelson@xxxxxxx.com>
> Date: Mon, 2 Jul 2001 09:29:50 -0600

> The compile command is:
> g++-cris -mlinux -xc++ -isystem /home/felson/axis/devboard_lx/eroot/include
> -Wall -O2 -DELINUX -Wall -I../include -Wno-ctor-dtor-privacy -ansi -pipe
> -c -o rs485_io.o rs485_io.cc

Lose -ansi *or* add -D_GNU_SOURCE to make the prototypes for
usleep and cfmakeraw visible.

I can't understand why errno is undeclared.  How does your
#include lines look like?  Is there an errno.h in ../include?

I tried this silly example (with #includes as per your earlier
mail), which compiles without warnings or errors with the listed
options (but with /home/felson tweaked for the local setup)
either adding -D_GNU_SOURCE or losing -ansi:

---------------------
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <signal.h>
#include <errno.h>
#include <stdlib.h>

#include <iostream.h>


class rs485_io
{
public:
  rs485_io::rs485_io(char *, int);
  void doit(struct termios *);
};

rs485_io::rs485_io(char *x, int y)
{
  usleep (y);
  cout << x << errno << endl;
}

void rs485_io::doit(struct termios *x)
{
  cfmakeraw (x);
}

int main ()
{
  rs485_io io("Hello, world!", 42);

  io.doit (NULL);
}
---------------------

> This all started with R2.0.0;  there were no compile errors for R1.0.0

Since it's a whole different runtime library, I wouldn't be too
surprised that some re-(or un-)tweaks are needed here and there
for things which were tweaked to work with uclibc.

If your program also works in your host environment, I'd just
try and remove defines and such that you add for devboard_lx.
Perhaps that -DELINUX makes a difference.

brgds, H-P