I am developing a Linux kernel module (driver) for an embedded system in the Eclipse IDE for C/C++ Linux Developers (Indigo SR2). I have added the kernel’s include directory to my project’s paths to index (Project > Properties > C/C++ General > Paths and Sybmols -> Includes (tab) -> Add … (button).) However, several of the kernel’s header files refer to the asm dir, which is really an overlay of the linux/asm-powerpc directory (in my case) over the top of the linux/asm-generic directory, where the specific version overrides the generic.
How can I tell Eclipse’s indexer to interpret “asm” as “asm-powerpc” first, and if that fails, then look in “asm-generic” second, instead of just looking for “asm”? Symlinking asm-powerpc to asm helps some, but too many header files exist only in the generic location to make this usable.
Thanks!
As I have discovered, there are many pieces required to direct Eclipse to index similarly to the kernel build process. However, the answer to this specific question was fairly simple:
Assuming your Linux kernel build directory is defined as
${KDIR}, and your kernel architecture is${ARCH}, then you need to add the following include paths to your project:${KDIR}/include${KDIR}/arch/${ARCH}/includeYou can do this in the
Project Explorer, by right clicking the project, thenProperties > C/C++ General > Paths and Symbols > Includes (tab) > Add ... (button).I was missing the second entry. Adding it resolved this question. With these 2 entries, checking for unresolved includes (Right click
Project > Index > Search for Unresolved Includes) produced 0 errors.Now I have hit another stumbling block. Some of the types (like, u32 and bool) are still undefined in Eclipse. (My Makefile does not produce any errors.) I believe this is related to some kernel specific variables being undefined in the Eclipse header parsing, causing the include’s IFDEF’s to not be evaluated the same as during the kernel module compilation. But, I have not resolved this yet, and that pertains to another question. 🙂