Results 1 to 4 of 4

Thread: error: stdio.h: No such file or directory

  1. #1
    Join Date
    Sep 2012
    Beans
    5

    error: stdio.h: No such file or directory

    when i makefile a module. i meet this problem, no such file or directory. it works if i use gcc -c. the o file appears.(i think i means the code is right). I installed the build-essential. and the stdio.h is in the direction usr/inculde/stdio.h(so the build-essential is already installed). i do not know what is going on.
    i tried 2 kind of Makefile both of them cannot work.
    Code:
    ifneq ($(KERNELRELEASE),)
        obj-m    := d.o
    
    else
        KDIR    := /lib/modules/$(shell uname -r)/build
        PWD        := $(shell pwd)
    
        default:
        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
        endif
    Code:
    obj-m := hello.o
    KERNELDIR ?= /usr/src/linux-source-3.2.0
    PWD := $(shell pwd)
    
    all:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
    Code:
    #include <stdio.h>
    #include <string.h>
    #include <fcntl.h>
    #include <errno.h>
    #include <termios.h>
    #include <unistd.h>
    #include <xdo.h>
    #include <X11/Xlib.h>
    #include <X11/keysym.h>
    the h file i include.
    Last edited by wxwx0104; September 15th, 2012 at 09:49 AM. Reason: adding

  2. #2
    Join Date
    Apr 2012
    Beans
    7,003

    Re: error: stdio.h: No such file or directory

    AFAIK the standard include paths are not searched during kernel compiles - the things you are trying to include really have no place in a kernel module - kernels have their own I/O routines (e.g. printk) and certainly shouldn't be using X11 headers

    http://tldp.org/LDP/lkmpg/2.6/html/lkmpg.html

    Hope this helps

  3. #3
    Join Date
    Sep 2012
    Beans
    5

    Re: error: stdio.h: No such file or directory

    Quote Originally Posted by steeldriver View Post
    AFAIK the standard include paths are not searched during kernel compiles - the things you are trying to include really have no place in a kernel module - kernels have their own I/O routines (e.g. printk) and certainly shouldn't be using X11 headers

    http://tldp.org/LDP/lkmpg/2.6/html/lkmpg.html

    Hope this helps
    you means i cannot include this files which not include in the linux source? I searched a lot. for example, <stdio.h> usually appears in the helloworld tutorial. and the x11/.h file is working for a keyboard driver. and the whole driver works well on other computers.

  4. #4
    Join Date
    Apr 2012
    Beans
    7,003

    Re: error: stdio.h: No such file or directory

    sorry this is beyond my level of expertise - I don't know what to suggest

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •