Subject: mor. c help needed
From: Rotary Engine
Date: 1/18/2010, 12:27 PM
To: AAA Put this in the To box



It's important to read C compiler errors from top to bottom. Don't
even bother reading the lower messages until you understand and
correct the upper ones. Follow the line numbers listed in the errors.

So, it appears to me that you are missing linux/mod_devicetable.h -
line 4 of usb.h includes it. That's the first error.

The messages above that are there you help find why the compiler ran
into an error - USBDAQ.h line 36 inlcudes USBDAQSample.h. Line 36 of
USBDAQSample includes USB.h. Line 4 of usb.h attempts to include
linux/mod_devicetable.h which apparently doesn't exist anywhere that
the compiler knows to look for it.

It's very useful to use an editor that readily displays the line
number that the cursor is on. Vim (vi, gvim) and emacs (xemacs) do
this directly.

Matt-

mod_devicetable.h is in the same directory I chose for usb.h

See the attached jpg.

Paul Lamar
The path to usb.h that the compiler is using is /usr/include/usb.h -
 as stated by the error message. I'm pretty sure the compiler is
 following the precedence of include paths. It doesn't appear that
 there's a "linux" dir in any of your included dirs. You specifically
 included which usb.h to use, but that doesn't help to find
 linux/mod_devicetable.h ..
Matt-
Yes there is Matt. Look at the fine print on top and bottom
 of this jpg I sent.
Then compare that with the parameters in the gcc command line.
 I think they match.
Paul Lamar
Hi Paul,
I'm far from an expert on gcc, not having used it for quite some time,
but I think you might need to use
gcc -I "root/usr/src/linux-headers-2.6.28-17/include/linux
so that all of the files in that directory will be available. Do not
use a trailing / after linux.
Bob W.


I have a / after Linux and before usb.h

Is that OK? I took it out but that did not help.

Paul Lamar

leave off the / and the usb.h. Kenney's suggestion is probably even
better, leave of the /linux also. So the command would be

gcc -I "root/usr/src/linux-headers-2.6.28-17/include

from looking at the man page for gcc, it looks to me like the next
thing should be -o usbtest then the file you are compiling. It might
be OK either way.

the whole thing would be:
gcc -I "root/usr/src/linux-headers-2.6.28-17/include
-o usbtest iUSBDAQsample.c
(without the return after include which my email client puts in)

Don't give up on this. It's a pain in the butt to get everything just
right, but then it works really slick. I remember one time spending
all day getting the hello world.c program to compile.

#include<stdio.h

main()
{ printf("hello, world\n");
}

or a version that complies with more modern standards:

#include <stdio.h

int main(void)
{
printf("hello, world\n");
return 0;
}


Bob

Thanks for the encouragement Bob. I needed that.

Paul Lamar

-- 
The Rotary Engine NewsLetter. Powered by Linux.
ACRE NL web site. http://www.rotaryeng.net
Youtube key word UTUBPLEASE
Copyright 1998-2009 All world wide rights reserved.