关于gcc编译的问题,如何知道其包含路径

benbensan 2004-04-05 09:09:14
Linux 7.3中同时有g++2.96和g++3.02
例如test.cpp
#include <iostream>
int main()
{
return 0;
}
看c++头文件应该在/usr/include/g++-2/iostream和/usr/include/g++-3/iostream
而g++ -o test test.cpp并没有指定包含的路径,g++如何知道包含那个文件
后来我又装了一个gcc3.3.3
文件在/usr/local/include/c++/3.3.3/iostream,如何让g++知道文件的位置呢

不要告诉我用-I/usr/local/include/c++/3.3.3 ,我想知道如何设置默认的
...全文
298 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
benbensan 2004-04-06
  • 打赏
  • 举报
回复
anonimousboy(stiwen) ,这样只能知道自己连接所用的lib吧,如何才能知道自己编译时所采用的头文件呢
anonimousboy 2004-04-06
  • 打赏
  • 举报
回复
gcc -print-search-dirs可以看到gcc要搜索的路径的列表,如果不在列表内,估计旧得用你所说的选项啦!
kaoziji 2004-04-06
  • 打赏
  • 举报
回复
info gcc中说:
search header files in the standard system directories
tukey 2004-04-05
  • 打赏
  • 举报
回复
up

23,110

社区成员

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

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