LINUX下C编程

yuyunliuhen 2007-12-27 08:46:26

#include<stdio.h>

int main()
{
printf("hello c");

return 0;
}


gcc -g -o hello hello.c
出现错误提示

tomy@tomy-desktop:~$ gcc -g -o hello hello.c
hello.c:1:18: error: stdio.h: No such file or directory
hello.c: In function ‘main’:
hello.c:5: warning: incompatible implicit declaration of built-in function ‘printf’

以前没在LINUX下进行C编程 这个在WINDOWS 用 GCC 能够编译通过 但在LINUX下面却提示找不到头文件呢? 请问是为什么,如何解决?

...全文
51 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuyunliuhen 2007-12-27
  • 打赏
  • 举报
回复
哈哈 谢谢戒指,继续研究 !
Treazy 2007-12-27
  • 打赏
  • 举报
回复
gcc -I/path

或者
利用系统的环境变量。
对于头文件的搜索路径:

C_INCLUDE_PATH=<your include path>;
export C_INCLUDE_PATH

对于库文件的搜索路径:

LIBRARY_PATH=<your lib path>;
export LIBRARY_PATH

对于链接程序ld使用的库文件搜索路径:

LD_LIBRARY_PATH=<your ldlib path>;
export LD_LIBRARY_PATH

23,121

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧