리눅스 헤더파일 참조 관련 질문입니다
글쓴이: 변유준 / 작성시간: 화, 2006/12/05 - 11:49오전
#include <sys/types.h> #include <linux/unistd.h> #include <errno.h>
-----------------------------------------------
저렇게 헤더파일 참조시 궁금한게 있어 질문올립니다
현재 Makefile 에 커널소스에 include 를 참조하라고 되어있는 상태이고
근데 커널소스밑에 include 폴더 밑에 보면 linux/unistd.h 파일은 있는데 sys/type.h 나 errnop.h 는 없습니다. 그럼 참조시 어떻게 저 파일을
참조하는지 궁금증이 생겨서 질문올립니다.
Makefile 에 -I 로 경로 말해준곳 말고 어떤곳을 또 참조를 하나요?
디폴트로든...
linux/ 폴더밑에 위 파일 세개 다있던데;;
의아해서 올립니다. 어떤식으로 참조가 되는지...
폴더 지정하면 그 밑에 하위폴더까지 전부 참조가 되는지요...
궁금합니다~
Forums:


<code></code>로 싸서 넣어주세요
안보니네요 코드로 싸서 넣어주세요
-------------------------------------------------------------------------------
이 댓글(comment)의 수정 및 삭제를 위해 이 글에 답글(reply)을 쓰지 말아 주십시요.
의견이 있으시면 원 글에 댓글(comment)로 써 주세요.
앗!!
다시 고쳣습니다!!
원래 없는게 정상입니다.
기본적으로 /usr/include 디렉토리를 참조하게됩니다.
linux/unistd.h 파일의 절대경로는
/usr/include/linux/unistd.h 파일입니다.
어플리케이션을 작성할 때 굳이 커널 소스의 include 디렉토리를 참조하도록 Makefile 을 작성하실 필요는 없구요
꼭 커널 소스의 include 디렉토리가 필요하다면
/usr/include/linux 디렉토리를 커널 소스의 include 디렉토리로 심볼릭 링크를 걸어서 사용하시는 것이 좋습니다.
다시 추가질문이요
폴더를 지정하면 하위폴더도 자동으로 추가가 되는건지 궁금합니다
[bushi@rose ~]$ gcc -c -v
[bushi@rose ~]$ gcc -c -v -o b b.c Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux Thread model: posix gcc version 4.1.1 20060525 (Red Hat 4.1.1-1) /usr/libexec/gcc/i386-redhat-linux/4.1.1/cc1 -quiet -v b.c -quiet -dumpbase b.c -mtune=generic -auxbase-strip b -version -o /tmp/cco0AGie.s ignoring nonexistent directory "/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc/i386-redhat-linux/4.1.1/include /usr/include End of search list. GNU C version 4.1.1 20060525 (Red Hat 4.1.1-1) (i386-redhat-linux) compiled by GNU C version 4.1.1 20060525 (Red Hat 4.1.1-1). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 7a31534f101210f86e6343d2c0c239f8 as -V -Qy -o b /tmp/cco0AGie.s GNU assembler version 2.16.91.0.6 (i386-redhat-linux) using BFD version 2.16.91.0.6 20060212 [bushi@rose ~]$...
[bushi@rose ~]$ [bushi@rose ~]$ gcc -c -v -o b b.c -I /usr/src/kernels/2.6.18-1.2239.fc5-i686/include/ Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux Thread model: posix gcc version 4.1.1 20060525 (Red Hat 4.1.1-1) /usr/libexec/gcc/i386-redhat-linux/4.1.1/cc1 -quiet -v -I /usr/src/kernels/2.6.18-1.2239.fc5-i686/include/ b.c -quiet -dumpbase b.c -mtune=generic -auxbase-strip b -version -o /tmp/ccUwOhuX.s ignoring nonexistent directory "/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/src/kernels/2.6.18-1.2239.fc5-i686/include/ /usr/local/include /usr/lib/gcc/i386-redhat-linux/4.1.1/include /usr/include End of search list. GNU C version 4.1.1 20060525 (Red Hat 4.1.1-1) (i386-redhat-linux) compiled by GNU C version 4.1.1 20060525 (Red Hat 4.1.1-1). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 7a31534f101210f86e6343d2c0c239f8 as -V -Qy -o b /tmp/ccUwOhuX.s GNU assembler version 2.16.91.0.6 (i386-redhat-linux) using BFD version 2.16.91.0.6 20060212 [bushi@rose ~]$하위 폴더에 대한 질문은..
라는 것에 대한 이해를 먼저 하시고 다시 생각해 보시라고 답변드리겠습니다.
댓글 달기