Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Preprocessor Include Paths, usage of include directories
Preprocessor Include Paths, usage of include directories [message #1712429] Sat, 24 October 2015 10:12 Go to next message
Herman Reintke is currently offline Herman ReintkeFriend
Messages: 2
Registered: October 2015
Junior Member
LS,

I have a project which is using a cross compiler (xtensa) for creating programs on an esp8266 micro controller board.
The project has a makefile in which the tools to be used are set.
f.e. CXX := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-g++

The project is configured with :
Toolchain : Cross GCC
Builder : Gnu Make Builder

To have the right includes for the c/c++ indexer there are additional directories defined in the Path and Symbols / Includes TAB.

But in the "Includes" of the project (set by eclipse) additional directories have been set
f.e. C:\mingw-w64\i686-5.2.0-posix-dwarf-rt_v4-rev0\mingw32\include
This results that the indexer can (and regular does) pick wrong definitions.

First thought was to define the Cross GCC compiler in use to be the correct one but I am unable to update the current one.

So I took a different path :

I configured the project with :
Toolchain : no toolchain
Builder : Gnu Make Builder

In this setup compiles are also OK.
For the c/c++ indexer it has the following consequences :
Eclipse does not add any "includes"
In Path and Symbols there is no "Includes" TAB anymore.
So I should add additional directories in the Preprocessor Include Paths, Macro option.

In there, in the CDT User Setting Entries I can
add an "Include Directory"
and/or "Include File"

And there I have the problem :
When including the directory c:\tools\sdk\include
The indexer doesn't pick up the .h files in there

But when including the file c:\tools\sdk\include\user_interface.h the indexer picks up the file and works as expected.

Questions :
- Can I, and if yes how, update the Cross GCC compiler actually used with Cross GCC toolchain
- How can I make the indexer correctly pick up the *.h files from the directory in Preprocessor Include Paths with No Toolchain
  • Attachment: Eclipse.PNG
    (Size: 31.96KB, Downloaded 307 times)
Re: Preprocessor Include Paths, usage of include directories [message #1712464 is a reply to message #1712429] Sun, 25 October 2015 13:16 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
You can edit the tool chain at: Project ==> Properties ==> C/C++ Build ==> Tool Chain Editor
But since you have selected no tool chain there won't be much to edit as you've pretty much said you will take control of everything including providing a make file.
See: http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_build_toolchain.htm
But, you can select a new chain there.

Without a tool chain, what Eclipse thinks which compiler is being used is not important except for parsing error messages. The tool chain is mostly for getting Eclipse to build a makefile. When creating a project it also causes some property values to be set.

Note that there are no include paths in the image you provided.
Even if you add the proper path, the indexer needs to be run. You can force it with Project ==> C/C++ Index ==> Rebuild.
Without a tool chain, it's not clear (to me) if the indexer ever gets run. is it enabled? Check: Project ==> Properties ==> C/C++ General ==> Indexer


[Updated on: Sun, 25 October 2015 13:24]

Report message to a moderator

Re: Preprocessor Include Paths, usage of include directories [message #1712721 is a reply to message #1712429] Tue, 27 October 2015 17:01 Go to previous message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
Herman Reintke wrote on Sat, 24 October 2015 13:12
LS,

Questions :
- Can I, and if yes how, update the Cross GCC compiler actually used with Cross GCC toolchain
- How can I make the indexer correctly pick up the *.h files from the directory in Preprocessor Include Paths with No Toolchain


Here are my settings for Cortex-M4, modify to suit yours:

Preprocessor Include Paths, Macros etc:
Providers
Remove check from CDT Cross GCC Builtin Settings
This gets rid of i386/i686 stuff

Entries / GNU C
CDT User Setting Entries
Add /usr/lib/arm-none-eabi/include
Add /usr/lib/gcc/arm-none-eabi/4.8.2/include
Add /usr/lib/gcc/arm-none-eabi/4.8.2/include-fixed
Add paths to your own header directories

Paths and Symbols
Include files
Add cortexm4-predef.h

The target processor predefine header file is generated
by the GCC in use:

arm-none-eabi-gcc -mthumb -mcpu=cortex-m4 -E -dM </dev/null >cortexm4-predef.h

The Project properties page wants to re-index after changes, let it do so.


--

Tauno Voipio
Previous Topic:STM32 library undefined reference
Next Topic:shared memory in windows as unix style file
Goto Forum:
  


Current Time: Wed Apr 24 23:41:57 GMT 2024

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

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

Back to the top