【发布时间】:2018-08-09 00:21:45
【问题描述】:
我在运行 Mac OS X 的系统上。我正在使用 Eclipse Oxygen.2 for C/C++,在我的例子中是 C++。我正在尝试创建一个使用 GSL 和 Boost 库的项目。但是,Eclipse 似乎无法找到 GSL 库并且似乎可以识别 Boost 库,但似乎无法执行 Boost 库中包含的任何操作。这两个库都是使用 Homebrew 安装的。这是我正在使用的代码:
#include <iostream>
#include <gsl.h>
#include <boost/optional.hpp>
using namespace std;
int main () {
int x = 5;
gsl::owner<int*> p = &x;
boost::optional<string>;
return 0;
}
错误如下:
#include <gsl.h>行显示fatal error: 'gsl.h' file not found。gsl::owner<int*> p = &x;行显示Symbol 'owner' could not be resolved。boost::optional<string>;行显示Type 'boost::optional<string>' could not be resolved。这个很奇怪,因为boost/optional.hpp文件似乎没有问题。
其他信息可能会有所帮助:
我正在使用 MacOS X 工具链。我应该切换到 Cross GCC 工具链吗?
以下是项目首选项 > C/C++ 构建 > 设置 > MacOS X C++ 链接器 > 库下列出的库搜索路径:/usr/local/Cellar/boost/1.66.0/include 和 /usr/local/Cellar/gsl/2.4/include。
我正在关注 Trevor Payne 的 Let's Learn C++ 教程系列。
【问题讨论】:
标签: c++ eclipse macos boost gsl