humanint 2017-12-09 12:33 采纳率: 100%
浏览 5241
已结题

Linux下gcc无法找到头文件

我的源码目录:main.c lib //lib是一个目录
我把头文件放在lib目录里面,gcc main.c -o test无法找到我放在lib目录里的头文件
在网上搜了一下,说要在 .bashrc 后面加一句:export C_INCLUDE_PATH=
以下是我.bashrc的配置:

.bashrc

User specific aliases and functions**

ali asrm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

#Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export C_INCLUDE_PATH=/root/projects/ConsoleApplication1/lib //这条是新加的

然后再用gcc,依然找不到头文件:
#运行 gcc main.c -o test
/tmp/cco8z3FL.o:在函数‘main’中:
main.c:(.text+0x2a):对‘errExit’未定义的引用
collect2: 错误:ld 返回 1

问题,头文件和源文件在不同的目录,如何编译呢?

  • 写回答

11条回答 默认 最新

  • lb686868 2017-12-09 13:15
    关注

    r each test case, just output a single integer, the number of convex quadrangles you can construct.
    Sample Inputfgfdgfdg

    评论

报告相同问题?

悬赏问题

  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗