zoukankan      html  css  js  c++  java
  • Makefile一 头文件及库搜索路径

     头文件及库搜索路径

    头文件的搜索路径:

    头文件的搜索规则是:找到就使用,停止继续往下寻找

    1:  #include “mytest.h”

    搜索的顺序为:

      (1)先搜索当前目录

      (2)然后搜索编译时 -I 指定的目录

      (3)在搜索gcc的环境变量CPLUS_INCLUDE_PATH

      (4)最后搜索gcc内定的目录

      /usr/include

    [root@centos-64-min include]# ls /usr/include/
    aio.h ftw.h neteconet stab.h
    aliases.h _G_config.h netinet stdint.h
    alloca.h gconv.h netipx stdio_ext.h
    a.out.h getopt.h netiucv stdio.h
    argp.h glob.h netpacket stdlib.h
    argz.h gnu netrom string.h
    ar.h gnu-versions.h netrose strings.h
    arpa grp.h nfs sys
    asm gshadow.h nl_types.h syscall.h
    asm-generic iconv.h nss.h sysexits.h
    assert.h ieee754.h obstack.h syslog.h
    bits ifaddrs.h paths.h tar.h
    byteswap.h inttypes.h poll.h termio.h
    c++ langinfo.h printf.h termios.h
    complex.h lastlog.h protocols tgmath.h
    cpio.h libgen.h pthread.h thread_db.h
    crypt.h libintl.h pty.h time.h
    ctype.h libio.h pwd.h ttyent.h
    dirent.h limits.h python2.6 ucontext.h
    dlfcn.h link.h rdma ulimit.h
    drm linux re_comp.h unistd.h
    elf.h locale.h regex.h ustat.h
    endian.h malloc.h regexp.h utime.h
    envz.h math.h resolv.h utmp.h
    err.h mcheck.h rpc utmpx.h
    errno.h memory.h rpcsvc values.h
    error.h mntent.h sched.h video
    execinfo.h monetary.h scsi wait.h
    fcntl.h mqueue.h search.h wchar.h
    features.h mtd semaphore.h wctype.h
    fenv.h net setjmp.h wordexp.h
    fmtmsg.h netapi.h sgtty.h xen
    fnmatch.h netash shadow.h xlocale.h
    fpu_control.h netatalk signal.h
    fstab.h netax25 sound
    fts.h netdb.h spawn.h

      /usr/local/include

    当前该目录下没有文件

      /usr/lib/gcc/x86_64-redhat-linux/4.1.1/include

    [root@centos-64-min local]# ls /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/
    abmintrin.h float.h nmmintrin.h syslimits.h
    ammintrin.h fma4intrin.h omp.h tbmintrin.h
    avxintrin.h immintrin.h pmmintrin.h tmmintrin.h
    bmiintrin.h iso646.h popcntintrin.h unwind.h
    bmmintrin.h limits.h smmintrin.h varargs.h
    cpuid.h lwpintrin.h stdarg.h wmmintrin.h
    cross-stdarg.h mm3dnow.h stdbool.h x86intrin.h
    emmintrin.h mmintrin.h stddef.h xmmintrin.h
    f16cintrin.h mm_malloc.h stdfix.h xopintrin.h

    2:#include <stdio.h>

    搜索顺序为:

      (1)先搜索 -I 指定的目录

      (2)然后搜索gcc的环境变量CPLUS_INCLUDE_PATH

      (3)最后搜索gcc内定目录,上面三个

    待续...

  • 相关阅读:
    Kafka发送和接收消息
    Kafka主题topic的增删改查
    Kafka启动
    synchronize底层实现原理
    StringBuffer和StringBuilder的区别
    常见的排序算法
    Redis缓存穿透,缓存击穿,缓存雪崩原理及解决方案
    Redis持久化策略
    redis支持的数据类型
    Bytes 类型
  • 原文地址:https://www.cnblogs.com/King-Penguin/p/5161910.html
Copyright © 2011-2022 走看看