/ usr / include linux中的新.h文件 [英] New .h file in /usr/include linux

查看:323
本文介绍了/ usr / include linux中的新.h文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在linux下开发小型c应用程序。对于这个应用程序,我将.h文件放在
linux标准路径(/ usr / include)中。输入:
FATA错误:找不到xyz.h(我自己的头文件) / p>

我是否需要更新gcc中的任何变量或解决此问题的方法?

谢谢

解决方案

将头文件放在与 .c 文件相同的目录中,并使用 -I。编译时

  gcc -I。 main.c -o myprog 

你不应该将你的头文件放在 / usr / include 用于系统头文件。



注意:您实际上并不需要 -I。因为当前目录是默认搜索的,不过,添加它并不会伤害。


I developed small c application in linux. For this application i placed .h file in linux standard path (/usr/include). Again i am compiling the same program

Output: FATA ERROR : xyz.h(my own header file) not found

Do i need to update any variable in gcc or way to solve this problem

Thank You

解决方案

Place the header file in the same directory as your .c file and use -I. when compiling

gcc -I. main.c -o myprog

You shouldn't place your header files in /usr/include that is meant for the system headers.

Note: you don't actually need the -I. because the current directory is searched by default, nevertheless, it doesn't hurt to add it.

这篇关于/ usr / include linux中的新.h文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆