1

I'm using Eclipse for a C++ project. I've been using Eclipse for this same project for a long time, but now I've reinstalled my Ubuntu, and installed Eclipse Oxygen and set it up again. The project compiles, there are no unresolved includes. But there is one annoyance.

This project uses rapidjson. And everywhere in the code, where some rapidjson-related object is used, it's colored as either a 'syntax error' or 'could not be resolved' by Eclipse. I've tracked this back to the rapidjson headers (which are included in the project), and Eclipse starts saying 'syntax error' right from the line where

namespace rapidjson {

starts, and it ends with the end of the namespace. The weirdest thing in all this is that if I change the name of the namespace to something else, like 'rapidjson2', the error disappears.

What could cause this weird behaviour?

lehoo
  • 21
  • 3
  • The renaming thing suggests that maybe Eclipse thinks that `rapidjson` is a macro which expands to something that would make that namespace declaration a syntax error. You can check this by hovering over the `rapidjson` - if Eclipse indeed thinks it's a macro, it should show you in the hover what it thinks the expansion is. – HighCommander4 Dec 20 '17 at 00:20
  • Thank you for taking the time to answer. I ended up deleting, then re-adding my project, reconfiguring it from scratch, and it hasn't happened this time. I must have misconfigured something, as I need to set the Include directories, adjust the Tool Chain, ... etc. for it to suit my needs. I'm not sure what went wrong, but it must have been some tiny detail. As for whether it was a macro ... maybe. It might explain the 'syntax error'. – lehoo Dec 20 '17 at 11:10

0 Answers0