• 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内定目录,上面三个

    待续...

  • 相关阅读:
    Android 自定义 ListView 上下拉动刷新最新和加载更多
    Android Activity 及其子类
    MySQL INSERT插入条件判断:如果不存在则插入
    MySQL中函数CONCAT及GROUP_CONCAT
    数据权限的设计与实现
    shiro过滤器过滤属性含义
    shiro注解
    python中,花括号,中括号,小括号的区别
    SpringBoot项目eclipse运行正常maven install打包启动后报错ClassNotFoundException
    Nginx对某个目录或整个网站进行登录认证的方法
  • 原文地址:https://www.cnblogs.com/King-Penguin/p/5161910.html
Copyright © 2020-2023  润新知