Makefile找不到由macports安装的boost库 [英] Makefile can not find boost libraries installed by macports

查看:655
本文介绍了Makefile找不到由macports安装的boost库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用 sudo port install boost 安装了来自macports的boost 1.42.0。

I just installed boost 1.42.0 from macports using sudo port install boost.

一切都很好。现在我有一个项目,我试图使用makefile。一切构建正常,直到它涉及到需要boost库的文件。

Everything worked fine. Now I have a project that I'm trying to build using a makefile. Everything builds fine until it comes to the file that needs the boost library.

它说:

src / graph.h:20:42:错误:boost / graph / adjacency_list.hpp:没有这样的文件或目录

It says:
src/graph.h:20:42: error: boost/graph/adjacency_list.hpp: No such file or directory

该文件实际位于两个地方:

/opt/local/include/boost/graph/adjacency_list.hpp



/opt/local/var/macports/software/boost/1.42.0_0/opt/local/include/boost/graph/adjacency_list.hpp

That file is actually located in two places:
/opt/local/include/boost/graph/adjacency_list.hpp
and
/opt/local/var/macports/software/boost/1.42.0_0/opt/local/include/boost/graph/adjacency_list.hpp

在文件src / graph.h中,它正在寻找boost / graph / adjacency_list.hpp,include语句在这里:

#include< boost / graph /adjacency_list.hpp>

In the file src/graph.h where it's looking for boost/graph/adjacency_list.hpp, the include statement is here:
#include<boost/graph/adjacency_list.hpp>

如何使这项工作?

推荐答案

您需要告诉编译器Boost的基本目录。您可以使用编译器的 -I 命令行选项:

You need to tell the compiler the base directory where Boost is intalled. You can do that with the compiler's -I command line option:

g++ -I/opt/local/include ...

这篇关于Makefile找不到由macports安装的boost库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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