(Solved) Indexer disagrees with compiler [message #1708494] |
Thu, 17 September 2015 07:31 |
Lyle Tafoya Messages: 6 Registered: September 2015 |
Junior Member |
|
|
Hello everyone,
I am using Eclipse Mars 4.5.0 with the CDT plugin and have been having a frustrating experience trying to get the indexer to work correctly. I am receiving errors such as the following
Quote:
Symbol 'string' could not be resolved component.h
Json::Value' could not be resolved component.h
Despite the errors, my code compiles fine. Even with all the warning flags turned on, I don't see anything unusual in the console output while compiling. By contrast, I do not experience this same issue while using another IDE such as Netbeans (although I would really prefer to use Eclipse).
Here are the steps detailing how I created my Makefile project with existing code in Eclipse:
(from Project > Properties)
1. C/C++ Build > Builder Settings > Generate Makefiles automatically = true
2. C/C++ Build > Settings > GCC C++ Compiler > Tool Settings > Dialect > Language Standard = ISO C++11
3. Preprocessor Include Paths, Macros etc. > Providers > CDT GCC Built-in Compiler Settings = ${COMMAND} -std=c++0x ${FLAGS} -E -P -v -dD "${INPUTS}"
4. C/C++ General > Indexer > Use active build configuration = true
5. C/C++ General > Indexer > Index source and header files opened in editor = true
I am using a GNU/Linux operating system and have verified that my includes are in the system path.
Here is some select data from the parser log file
Quote:
Include Search Path (option -I):
/usr/include/c++/5.2.0
/usr/include/c++/5.2.0/x86_64-unknown-linux-gnu
/usr/include/c++/5.2.0/backward
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include
/usr/local/include
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include-fixed
/usr/include
Unresolved includes (from headers in index):
file:/usr/include/c++/5.2.0/iostream is not indexed
file:/usr/include/c++/5.2.0/vector is not indexed
file:/usr/include/c++/5.2.0/string is not indexed
file:/usr/include/json/json.h is not indexed
file:/home/lyle/Programming/OpenCGE/Engine/component.h is not indexed
Unresolved names:
Attempt to use symbol failed: std in file /home/lyle/Programming/OpenCGE/Engine/entity.h:11
Attempt to use symbol failed: vector in file /home/lyle/Programming/OpenCGE/Engine/entity.h:11
Attempt to use symbol failed: std in file /home/lyle/Programming/OpenCGE/Engine/entity.h:13
Attempt to use symbol failed: string in file /home/lyle/Programming/OpenCGE/Engine/entity.h:13
Attempt to use symbol failed: size_t in file /home/lyle/Programming/OpenCGE/Engine/entity.h:23
Attempt to use symbol failed: Json in file /home/lyle/Programming/OpenCGE/Engine/entity.h:26
Attempt to use symbol failed: Value in file /home/lyle/Programming/OpenCGE/Engine/entity.h:26
Attempt to use symbol failed: size_t in file /home/lyle/Programming/OpenCGE/Engine/entity.h:27
Attempt to use symbol failed: string in file /home/lyle/Programming/OpenCGE/Engine/entity.h:31
Attempt to use symbol failed: string in file /home/lyle/Programming/OpenCGE/Engine/entity.h:32
Attempt to use symbol failed: string in file /home/lyle/Programming/OpenCGE/Engine/entity.h:34
Attempt to use symbol failed: Json in file /home/lyle/Programming/OpenCGE/Engine/entity.h:37
Attempt to use symbol failed: Value in file /home/lyle/Programming/OpenCGE/Engine/entity.h:37
I have verified that the included files are all located in the correct location according to where the parser is looking and that the permissions
Here is a piece of code from the top of entity.h showing the missing libraries being included
#ifndef _ENTITY_H
#define _ENTITY_H
#include <iostream>
#include <vector>
using std::vector;
#include <string>
using std::string;
#include <json/json.h>
#include "component.h"
I have verified that the includes are in the expected location according to the parser log and that the permissions are set appropriately. I have tried cleaning, re-indexing, restarting, re-building, re-creating, and all kinds of different combinations of settings and potential fixes I found in other similar issues. So far nothing has worked. How can I get it to index the above files? Why is it not able to parse them even though the compiler can? Should this be filed as a bug report or is there some configuration settings I'm missing?
I have attached the full parser log. Please let me know if there is any additional information I can provide you with to help. Thank you.
-
Attachment: Untitled.log
(Size: 10.68KB, Downloaded 266 times)
[Updated on: Sun, 20 September 2015 17:07] Report message to a moderator
|
|
|
Re: Indexer disagrees with compiler [message #1708685 is a reply to message #1708494] |
Fri, 18 September 2015 17:01 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
Take a peek at Project Explorer ==> <project> ==> Includes.
It looks like the files included by entity.h aren't being searched.
Note the mentioning of std and vector.
Are all of the paths present?
/home/lyle/Programming/OpenCGE/Engine should be there.
If not, you will need to either add it manually to the indexer search path Project Properties ==> C/C++ General ==> Preprocessor Paths, Macros, etc.
or examine the discovery options Project Properties ==> C/C++ Builld ==> DIscovery Options to ensure it is enabled by selecting Auto mate discovery of paths and symbols 2) maybe enable Report path detection problems as well. Note that, when selecting automated discovery, a notice appears that it is deprecated. I don't use it myself
Sometimes, for whatever reason, the indexer refuses to examine some include files. In this case and as a last resort, it is necessary to insert definitions that only the indexer can see. You do this by surrounding them with __CDT_PARSER__ preprocessor statements.
#ifdef __CDT_PARSER__
:
:
:
#endif
Needless to say, this could be a nuisance.
You could also try inserting the same includes in the source file that references entity.h someplace before the reference.
[Updated on: Sat, 19 September 2015 13:35] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Indexer disagrees with compiler [message #1708736 is a reply to message #1708735] |
Sat, 19 September 2015 16:26 |
Lyle Tafoya Messages: 6 Registered: September 2015 |
Junior Member |
|
|
One more thing:
I found that if I switch to my master branch and rebuild the index there are no errors. If I switch back to development and rebuild the index all the errors come back. Something about my code seems to be causing issues with the parser. However, my code is all syntactically correct. I have successfully compiled it without issues using both clang and g++.
[Updated on: Sat, 19 September 2015 16:27] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04157 seconds