Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » include inside include - strange behavour !(include inside include - strange behavour !)
include inside include - strange behavour ! [message #1764232] Fri, 26 May 2017 21:54 Go to next message
ran shalit is currently offline ran shalitFriend
Messages: 10
Registered: January 2015
Junior Member
Hello,

I have got some project package, which I imported in eclipse kepler (same version as was released) in windows 10.
But now I see strange beaviour:
1. the first build is OK
2. But on modifying some c file I get error on unresolved symbols.
though those symbols are declares in headers:
in the c file:
#include <myheaders.h>


myheades.h just include other files:
#include <myheaders_1.h>
#include <myheaders_2.h>
....


If I just put the content of myheaders.h in the c file it compiles without issues:

#include <myheaders_1.h>
#include <myheaders_2.h>
....

Then it all compiles without issues !

I have no idea why it behaves like this.

Please help,
Ran

[Updated on: Fri, 26 May 2017 21:55]

Report message to a moderator

Re: include inside include - strange behavour ! [message #1764481 is a reply to message #1764232] Tue, 30 May 2017 12:32 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Can you expand please? Are you getting build errors? If so can you include the build console out please.

If not, Perhaps you are getting Indexer errors instead and CDT is failing to find the headers. If you have any way of making a minimal reproducible test case then I can hopefully help you resolve it.
Re: include inside include - strange behavour ! [message #1764503 is a reply to message #1764481] Tue, 30 May 2017 14:53 Go to previous messageGo to next message
ran shalit is currently offline ran shalitFriend
Messages: 10
Registered: January 2015
Junior Member
Hi Jonah !

Thanks for suggestions!
I am not sure I can create simple reproducible, but I did noticed that the "errors" are "not real", which means, the CDT builds the executable, it only shows errors in some strange cases:
1. for example it happens if I just open a file inside eclipse, it suddendly shows the "x" on the file, and in "problems" list the errors in the file.
I also saw errors in line of code as following, as if it is illegal:
var1 = var1

Yet, the code builds the image ! which means it is "fake error" (fake news...).
1. Is this what you mean by "Indexer errors" ? Is there a way to get rid of it ?
2. How can I discern between fake error to real error, is it by looking at the compile log window instead of the "problems" window ?

Thanks!
Re: include inside include - strange behavour ! [message #1764511 is a reply to message #1764503] Tue, 30 May 2017 16:14 Go to previous message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Hi,

What you are seeing (Indexer errors) is Eclipse CDT parsing and analyzing the code. This can fail in a few ways:

1- "Indexer" does not find your source files the provide needed definitions, so CDT gives you errors you don't get when you build
2- Some constructs are not supported in CDT, normally affects newest C++ features. The newest C++ features are actively being worked on and the upcoming Oxygen version in June 2017 has lots of improvements in that regard.
3- Semantic Code analysis mis anlayses your code, or you don't agree with its analysis.
4- A bug in CDT

Solutions:

1- This normally happens when CDT does not understand structure of your code. This happens more often when using your own Makefiles/etc than if you use CDT's makefile generator. Adjust settings in Project Properties -> C/C++ General -> Paths and Symbols.

2- You can sometime work around unsupported language constructs by adding in some conditional compilation. The __CDT_PARSER__ macro is defined when CDT is parsing the code. The obvious disadvantage is that the IDE should not be changing the code. If you are using the latest version of Eclipse CDT, please file a bug with the failing construct.

3- You can tune semantic analysis (sometimes called codan -- code analysis). Either in project properties or preferences C/C++ (General) --> Code Analysis and turn on/off desired analysis tests.

4- File a bug: https://bugs.eclipse.org/bugs/enter_bug.cgi?product=CDT - contribute a patch: https://wiki.eclipse.org/CDT/contributing

I hope that helped,

Jonah
Previous Topic:Eclipse Neon + CDT does not set Environment LD_LIBRARY_PATH
Next Topic:Scanner Discovery (Build Output Parser) doesn't work with -iquote
Goto Forum:
  


Current Time: Mon Sep 23 14:44:33 GMT 2024

Powered by FUDForum. Page generated in 0.03281 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top