简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM