Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Indexer detects wrong include file of two possibilities
Indexer detects wrong include file of two possibilities [message #989026] Tue, 04 December 2012 05:54 Go to next message
Eclipse UserFriend
Hello.

I'm using Eclipse Juno with CDT 8.1 on Windows.

I'm developing software mainly for a Target microcontroller. But I have the possibility to generate code for a Simulation of the code on a PC.

To separate between 'Target' and 'Simulation' I use two different Output directories:
'Target' = 'bin'
'Simulation' = 'sim'.

Underneath those directories there is a similar tree with a header file of the same name but different content ('Target' or 'Simulation'):

<Project dir>
- bin
-- include
--- generated
---- autoconf.h
:
:
-sim
-- include
--- generated
---- autoconf.h
:

Somewhere in my code there is

#include <generated/autoconf.h>

And here is my problem:

When I 'follow' this include (F3 or Strg-Click), I ALWAYS get the 'autoconf.h' from sim. And therefore the Eclipse Indexer is highlighting for 'sim' and not for 'bin' as I request.

I have already inserted in
<Project Properties> | C/C++ General | Paths and Symbols | Includes | GNU C
the entry

<Project path>/bin/include


What do I have to do to create a Configuration, in which the upper 'F3' brings me to the include of the bin folder???

TIA
Dirk
Re: Indexer detects wrong include file of two possibilities [message #989075 is a reply to message #989026] Tue, 04 December 2012 09:33 Go to previous messageGo to next message
Eclipse UserFriend
You should create two build configurations
http://help.eclipse.org/juno/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_manage_dialog.htm?cp=11_4_7_0_2_0

Then in Project Properties set the source location for every build config
http://help.eclipse.org/juno/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_general_pns_src.htm?cp=11_4_7_0_4_5_4

In C/C++ Project Properties, C/C++ Indexer
http://help.eclipse.org/juno/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_general_idx.htm?cp=11_4_7_0_4_3

you can select which build configuration the indexer will use.
Re: Indexer detects wrong include file of two possibilities [message #989082 is a reply to message #989075] Tue, 04 December 2012 10:01 Go to previous messageGo to next message
Eclipse UserFriend
Axel Mueller wrote on Tue, 04 December 2012 15:33
You should create two build configurations
http://help.eclipse.org/juno/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_manage_dialog.htm?cp=11_4_7_0_2_0


Yes . . . I understand that.

Axel Mueller wrote on Tue, 04 December 2012 15:33
Then in Project Properties set the source location for every build config
http://help.eclipse.org/juno/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_general_pns_src.htm?cp=11_4_7_0_4_5_4


This I don't understand.

Here is my project structure (also as attachment):

index.php/fa/12593/0/

'bin' and 'sim' are in the SAME project parallel by the source folders.
The 'Source Location' for BOTH build configs would therefore be 'GV642_Premium_Bosch' !?!?

Axel Mueller wrote on Tue, 04 December 2012 15:33
In C/C++ Project Properties, C/C++ Indexer
http://help.eclipse.org/juno/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_general_idx.htm?cp=11_4_7_0_4_3

you can select which build configuration the indexer will use.


If the second point above is clear, then I fully understand the last point.


THX for the help.

Regards
Dirk
Re: Indexer detects wrong include file of two possibilities [message #989416 is a reply to message #989082] Thu, 06 December 2012 02:26 Go to previous messageGo to next message
Eclipse UserFriend
Sorry . . . but *BUMP*.

At least I would like to know, how/why the Indexer prefers the 'sim' directory over the 'bin' directory?
And how can I change/revert that 'attitude'?

THX in advance.
Re: Indexer detects wrong include file of two possibilities [message #989507 is a reply to message #989082] Thu, 06 December 2012 09:36 Go to previous messageGo to next message
Eclipse UserFriend
You can define exclude filters for the source location.
e.g.
Config1
source location GV642_Premium_Bosch
exclude bin

Config2
source location GV642_Premium_Bosch
exclude sim

see
http://help.eclipse.org/juno/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_general_pns_src.htm?cp=11_4_7_0_4_5_4
Re: Indexer detects wrong include file of two possibilities [message #989654 is a reply to message #989507] Fri, 07 December 2012 03:17 Go to previous messageGo to next message
Eclipse UserFriend
Hello Axel,

first THX for the reply.

I'm sorry, but that didn't work either.
I have excluded 'sim' in 'Source location' and did a 'Rebuild Index'.
Then I have navigated again and I ended again falsely in 'sim'.
This screenshot is the situation directly after the last 'F3':

index.php/fa/12630/0/

Even as 'autoconf.h' is (obviously) excluded, it is highlighted and opened in an editor. Confused

And here are the 'Indexer' settings in the PROJECT:

index.php/fa/12631/0/

Is there the possibility of a bug in CDT?

My only way to get it working properly is to RENAME the 'sim' folder and 'Rebuild Index'.
Re: Indexer detects wrong include file of two possibilities [message #989687 is a reply to message #989654] Fri, 07 December 2012 05:19 Go to previous messageGo to next message
Eclipse UserFriend
Did you add sim folder in Project Properties->General->Paths and Symbols->Includes?
Re: Indexer detects wrong include file of two possibilities [message #989932 is a reply to message #989687] Mon, 10 December 2012 02:07 Go to previous messageGo to next message
Eclipse UserFriend
Nope.

On the opposite I've even added 'bin' and 'bin\generated' as Includes with no success.
Re: Indexer detects wrong include file of two possibilities [message #1796994 is a reply to message #989932] Tue, 23 October 2018 12:17 Go to previous messageGo to next message
Eclipse UserFriend
What does it take to get eclipse to index correctly? It doesnt appear able to actually go and look in the right file
header1.h
struct fred{
int a
}fred_t;

header2.h
struct fred{
int b
};

file.c
fred _t*ptr

goes to header2 EVEN THOUGH HEADER2 is NOT EVER INCLUDED IN THE PROJECT but just happens to be in the same tree!
Re: Indexer detects wrong include file of two possibilities [message #1797024 is a reply to message #1796994] Wed, 24 October 2018 04:57 Go to previous message
Eclipse UserFriend
I tried this with a sample HelloWorld project.
Not sure what you were trying to do
but header1.h is declaring a variable named fred_t as struct fred .
It should have a typedef.

In any case, using Photon (4.8.0) and CDT (9.5.2.2018071141),
I get the proper file from an F3
although I get a syntax error without the typedef.

When I hover over fred_t in main.c I get the proper definition.

You don't say which Eclipse and CDT you are using.

I don't think there is any way to stop the Indexer from scanning files in a directory unless the directory is marked as
Excluded (RC dir in Project View --> Resource Configurations --> Exclude from Build ...)
and the Index Source files not included in the build is deselected.
(Project --> Properties --> C/C++ General --> Indexer)

The Indexer doesn't handle multiple definitions nicely though.
This is particularly true of macros.
The test I ran is rather simple.
Perhaps a more complicated one would confuse the Indexer.

header1.h
#ifndef HEADER1_H_
#define HEADER1_H_

typedef struct fred{
	int a;
} fred_t;

#endif /* HEADER1_H_ */

header2.h
I used float so I could tell which was being used when hovering.
I changed the float to int but F3 still goes to the proper header file.
I also tried changing the 'b' to an 'a' and it still worked properly.
#ifndef HEADER2_H_
#define HEADER2_H_

typedef struct fred{
	float b;
} fred_t;

#endif /* HEADER2_H_ */

main.c
#include <stdio.h>
#include <stdlib.h>

#include "header1.h"

int main(void) {
	fred_t * pFred;
	puts("Hello World"); /* prints Hello World */
	return EXIT_SUCCESS;
}
Previous Topic:C / C++ Build properties
Next Topic:Codan problem/bug?
Goto Forum:
  


Current Time: Wed Jul 23 10:56:47 EDT 2025

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

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

Back to the top