Eclipse CDT project with armadillo - CDT does not recognize 'arma' namespace

假如想象 提交于 2019-12-12 01:52:28

问题


I'm running on a CentOS 6.5 x64 OS and have used yum to install armadillo. I'm developing in Eclipse CDT

I've included the armadillo header in the project properties >> C/C++ Build >> Settings >> GCC C++ Compiler >> Includes >> Include files. The entry is: "/usr/include/armadillo"

The header file I am working on recognizes armadillo and the include statement isn't flagged for any errors or warnings.

Below is the code:

#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

I've checked the file /usr/include/armadillo and it does include the namespace arma section.

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

// preliminaries
...

I've also checked the permissions and the /usr/include/armadillo file is readable to all users.

The problem is when I add the "using namespace arma", CDT marks it as an error and says that "Symbol 'arma' could not be resolved".

At this point, I don't have any other ideas to figure out why the namespace isn't recognized. Any insights or pointers to figure this out would be much appreciated.


回答1:


This question's answer provided the answer to my issue: Clean Eclipse Index, it is out of sync with code

Josh Kelley's answer from the linked issue:

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.

After running Index >> Rebuild and Index >> Freshen All Files, the errors were gone.



来源:https://stackoverflow.com/questions/27003438/eclipse-cdt-project-with-armadillo-cdt-does-not-recognize-arma-namespace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!