On Wed, Feb 22, 2012 at 10:10 PM, imato <cooper.zp@...> wrote:
> I found an i2c-dev.h file from the internet. I post it here. can
> anyone tell me if this is the correct head file? Do I just save the content
> of this file to an i2c-dev.h file in my computer?
In general this is a bad idea. The include file you use must match the
version of the kernel you are using for your target system. If you
have followed the instructions on "Using the Open Embedded Build
System for Overo Series" from the gumstix website
and have successfully built an image for your overo the include file
you require will already be found in your sysroot:
This file will be found by your cross-compiler when you build your
application, if you are using the correct methods to build your
application with the OE system that you used to build your overo image
(from the link given above).
> meanwhile, I have read the i2c example from gumstix wiki page. It uses
> #include <linux/i2c-dev.h>.
> Why not is it #include <i2c-dev.h>
The "i2c-dev.h" file comes from the linux kernel. Most projects which
install many header files keep their files under separate
subdirectories under <sysroot>/usr/include. For example ncurses keeps
its header files in <sysroot>/usr/include/ncurses/. Your correctly
sysroot'ed cross-compiler will automatically look in
<sysroot>/usr/include for header files (unless you explicitly tell it
not to) so to find <sysroot>/usr/include/linux/filename you need to
put "#include <linux/filename>" in your source file.