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

location of system headers



I'm having trouble finding the right system includes to compile my
sources for use with my development board.

I've installed cris 1.17, dev_board 2_1_0 and kernelsources 2.4.14,
put a small example under /apps/broadcast, one c++ file
called broadcast.cpp (listed below)

I created a makefile in /apps/broadcast, which is just
like the example in the documentation. (listed below)

Now in devboard_lx/
I run . ./init_env
./install
in broadcast I issue
make cris-axis-linux-gnu
and
make

Now I get errors about 'uint' and 'inet_aton'.
The include files seem to be found, when I change their names to something
non-existing, the compiler tells me it can't find them.

Even when I do

make host
make

the example does not compile.
However, when I comment out the Rules.elinux include from the makefile,
it compiles fine.

Can someone point me at what I'm doing wrong here?

Only listings below here

--------------------------------------------------
makefile:
--------------------------------------------------

AXIS_USABLE_LIBS = GLIBC UCLIBC
include $(APPS)/Rules.elinux

PROGS = broadcast

INSTDIR = $(prefix)/bin/
INSTMODE = 0755
INSTOWNER = root
INSTGROUP = root

OBJS = broadcast.o
 
all: $(PROGS)

$(PROGS): $(OBJS)
	$(CC) $(LDFLAGS) $(LDADD) $^ $(LDLIBS) -o $@

install:	$(PROGS)
	$(INSTALL) -d $(INSTDIR)
	$(INSTALL) -m $(INSTMODE) -o $(INSTOWNER) -g $(INSTGROUP) $(PROGS) $(INSTDIR)

clean:
	rm -f $(PROGS) *.o core


------------------------------------------------------
listing of broadcast.cpp:
------------------------------------------------------

#include <sys/types.h>

#include <sys/socket.h>

#include <netinet/in.h>
#include <arpa/inet.h>

int main()
{
   uint temp = 0;

   int broadcastsocket = socket(PF_INET,SOCK_DGRAM,0);

   struct sockaddr_in our_address;
   our_address.sin_family = AF_INET;
   our_address.sin_port = htons (2000);
   our_address.sin_addr.s_addr = htonl (INADDR_ANY);

   if (bind (broadcastsocket, (struct sockaddr *) &our_address, sizeof 
(our_address)) < 0)
   {
      return -1;
   }

   struct sockaddr_in to_address;

   inet_aton("255.255.255.255", &to_address.sin_addr);

   to_address.sin_family = AF_INET;
   to_address.sin_port = htons (2000);

   if (!sendto(broadcastsocket, "broadcast data", 14, 0, (struct sockaddr *) 
&to_address, sizeof(to_address)))
   {
      return -1;
   }
}