c++ - 带 Armadillo 的 Eclipse CDT 项目 - CDT 无法识别 'arma' 命名空间

标签 c++ eclipse eclipse-cdt armadillo

我在 CentOS 6.5 x64 操作系统上运行并使用 yum 安装 Armadillo 。我在 Eclipse CDT 中开发

我在项目属性 >> C/C++ 构建 >> 设置 >> GCC C++ 编译器 >> 包含 >> 包含文件中包含了 Armadillo header 。条目是:“/usr/include/armadillo”

我正在处理的头文件可以识别 Armadillo 并且 include 语句没有标记任何错误或警告。

代码如下:

#include <armadillo>

using namespace std;
using namespace arma; // arma is not recognized as a symbol

const double DEGREES_PER_RADIAN = 180.0 / datum::pi; // datum is not recognized

我检查了文件 /usr/include/armadillo,它确实包含命名空间 arma 部分。

//! \namespace arma namespace for Armadillo classes and functions
namespace arma
{

// preliminaries
...

我还检查了权限,/usr/include/armadillo 文件对所有用户都是可读的。

问题是当我添加“使用命名空间 arma”时,CDT 将其标记为错误并提示“无法解析符号‘arma’”。

在这一点上,我没有任何其他想法来弄清楚为什么命名空间无法被识别。任何解决这个问题的见解或指示将不胜感激。

最佳答案

这个问题的答案为我的问题提供了答案: Clean Eclipse Index, it is out of sync with code

Josh Kelley 在相关问题中的回答:

Right-click on your project, go under the Index submenu, and choose either "Rebuild," "Update with modified files," or "Freshen all files."

I don't know the difference between those three options, but one of "Update with modified files" or "Freshen all files" usually fixes it for me.

Also, I'm sure you've already done this, but make sure that you're running the latest version of the Eclipse CDT. Current versions seem to have much more reliable indexing than previous versions.

运行 Index >> Rebuild and Index >> Freshen All Files 后,错误消失了。

关于c++ - 带 Armadillo 的 Eclipse CDT 项目 - CDT 无法识别 'arma' 命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27003438/

相关文章:

c++ - 在 Visual C++ 中,出现警告但程序没有继续运行,有什么办法可以忽略它吗?

c++ - 获取除第一个元素以外的所有元素作为单独的 vector

java - 耳朵和 war 没有建立

java - 在远程计算机上执行 jar 失败

c++ - Eclipse C++ : class, 命名空间,未找到枚举

c++ - 吸氧剂,Eclox : Functions autocomplete not working with decorating macros

C++ 专门化模板类以获取额外的模板参数

eclipse - 在 Eclipse Project Explorer 中取消灰色文件

c - 如何将qemu项目导入Eclipse IDE

c - Eclipse CDT 调试不是可执行格式 : File format not recognized after strawberry installation