g++ include all /usr/include recursively
来源:互联网 发布:周杰伦才华 知乎 编辑:程序博客网 时间:2024/06/05 14:57
6down votefavorite
2
I'm trying to compile a simple program, with
#include <gtkmm.h>
The path to gtkmm.h
is /usr/include/gtkmm-2.4/gtkmm.h
. g++ doesn't see this file unless I specifically tell it-I /usr/include/gtkmm-2.4
.
My question is, how can I have g++ automatically look recursively through all the directories in/usr/include
for all the header files contained therein, and why is this not the default action?
In this case, the correct thing to do is to use pkg-config
in yourMakefile
or buildscripts:
# Makefileifeq ($(shell pkg-config --modversion gtkmm-2.4),) $(error Package gtkmm-2.4 needed to compile)endifCXXFLAGS += `pkg-config --cflags gtkmm-2.4`LDLIBS += `pkg-config --libs gtkmm-2.4`BINS = programprogram_OBJS = a.o b.o c.oall: $(BINS)program: $(program_OBJS) $(CXX) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@# this part is actually optional, since it's covered by gmake's implicit rules%.o: %.cc $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
If you're missing gtkmm-2.4
, this will produce
$ makePackage gtkmm-2.4 was not found in the pkg-config search path.Perhaps you should add the directory containing `gtkmm-2.4.pc'to the PKG_CONFIG_PATH environment variableNo package 'gtkmm-2.4' foundMakefile:3: *** Package gtkmm-2.4 needed to compile. Stop.
Otherwise, you'll get all the appropriate paths and libraries sucked in for you, without specifying them all by hand. (Check the output ofpkg-config -
-cflags --libs gtkmm-2.4
: that's far more than you want to type by hand, ever.)
http://stackoverflow.com/questions/510098/g-include-all-usr-include-recursively
- g++ include all /usr/include recursively
- /usr/include/pthread.h
- linux include 头文件 存放处 /usr/include
- 关于/usr/src/linux/include/linux和/usr/include/linux
- 关于/usr/include/linux和/usr/src/linux/include/linux/
- 关于/usr/include/linux和/usr/src/linux/include/linux/
- 关于/usr/include/linux和/usr/src/linux/include/linux/
- 《转》/usr/include/regex.h
- /usr/include/asm/errno.h
- Mac下/usr/include缺失
- Mac下/usr/include缺失
- Mac下/usr/include缺失
- Mac下/usr/include缺失
- #include
- include
- #include
- include
- #include
- adb下查看应用包名和应用主界面
- Java并发编程之CAS
- 【Mongo】uploadify插件帮助实现批量上传
- Linux内核转发技术
- javascript控制input只允许输入数字
- g++ include all /usr/include recursively
- select同时处理普通数据及带外数据
- Java正则表达式小记
- linux su命令参数及用法详解
- 大数据驱动下的微博社会化推荐
- 少走弯路的10条建议
- 欢迎使用CSDN-markdown编辑器
- 生成多个不重复的随机数字php
- iOS开发者证书-详解/生成/使用,iOS CA认证