2

I have code written in C and I have included some libraries such as linux/config.h and linux/kernel.h.

Whenever I compile the file, it gives me an error saying No such file or directory ?

Is there a certain program I should install first ? How can I solve this error ?

  • 1
    Are you sure that those files are in your include path for headers? – Misery May 13 '13 at 11:12
  • No I just downloaded the driver and that is what I got when I compiled the file ? but as you asked I check and all the header files are in directory usr/src/linux-headers-3.2.0-41/include/linux ?? does this help ?? – Zeyad May 13 '13 at 11:44
  • 1
    Maybe this quick and dirty solution works: Add "-I/usr/src/linux-headers-3.2.0-41/include/" to your $CFLAGS when running configure, make, etc (if you have no CFLAGS yet, you can simply write "CFLAGS='-I/usr/src/linux-headers-3.2.0-41/include/' make"). This should instruct your compiler to look in that folder. – soulsource May 13 '13 at 12:03
  • @Zeyad: I think that your compiler simply has no access to that path. You need to inform your compiler where to seek for this files. Instead of #include "linux/config.h" write: #include "usr/src/linux-headers-3.2.0-41/include/linux/config.h". Does this help? – Misery May 13 '13 at 12:40
  • @Misery yes it helped it was not able to acess the directory thanks alot – Zeyad May 13 '13 at 22:12
2

As the link below explains, somewhere in the 2.6.19 kernel, linux/config.h was removed.

http://www.linuxquestions.org/questions/linux-kernel-70/removal-of-include-linux-config-h-file-in-2-6-19-kernel-506363/

| improve this answer | |
1

If instead of

#include "linux/config.h" 

writing:

#include "usr/src/linux-headers-3.2.0-41/include/linux/config.h"

helps, it means that your compiler doesn't know where to look for include files.

If you are using makefile or command-line compilation then this page will explain what was happening. Othwerise, if you are using some IDE like Eclipse or Code::Blocks, than you need to find project opsions and add include file directries.

Regards, Misery

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.