changing include order?

Status
Not open for further replies.

WMXZ

Well-known member
Is it possible to tell Arduino to put the cores/teensy3 includes AFTER the local library includes?
Or is this fixed?

Edit: To give the issue
I like to use functionality of latest CMSIS DSP library (copied lo local library) WITHOUT editing core's arm_math.h

Unfortunately Include sequence generated by Arduino places core before local libraries.
Only work around is to copy/duplicate arm_math.h and other DSP files in sketch file. I consider this not, let me say ideal!

Edit: In other words: Include order should be the same as link order!
 
Last edited:
Is it possible to tell Arduino to put the cores/teensy3 includes AFTER the local library includes?
Or is this fixed?

Edit: To give the issue
I like to use functionality of latest CMSIS DSP library (copied lo local library) WITHOUT editing core's arm_math.h

Unfortunately Include sequence generated by Arduino places core before local libraries.
Only work around is to copy/duplicate arm_math.h and other DSP files in sketch file. I consider this not, let me say ideal!

Edit: In other words: Include order should be the same as link order!

After reading a little bit on the Web, I note that
"Arduino finds libraries based on .h names. It also prefers user installed libraries to arduino delivered libraries."
so what is really the problem
It is not Arduino, it is IMO Teensyduino generating the problem
I copy the error log (snippet)

Compiling sketch...
"C:\Users\Walter\Documents\arduino-1.8.2\hardware\teensy/../tools/arm/bin/arm-none-eabi-g++" -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -fno-exceptions -felide-constructors -std=gnu++0x -fno-rtti -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -D__MK66FX1M0__ -DTEENSYDUINO=136 -DARDUINO=10802 -DF_CPU=168000000 -DUSB_MIDI_AUDIO_SERIAL -DLAYOUT_US_ENGLISH "-IC:\Users\Walter\Documents\arduino-1.8.2\hardware\teensy\avr\cores\teensy3" "-IC:\Users\Walter\Documents\Arduino\libraries\wmxzDSP\src" "C:\Users\Walter\AppData\Local\Temp\arduino_build_139169\sketch\test_include.ino.cpp" -o "C:\Users\Walter\AppData\Local\Temp\arduino_build_139169\sketch\test_include.ino.cpp.o"
In file included from C:\Users\Walter\Documents\Arduino\libraries\wmxzDSP\src/arm_const_structs.h:47:0,

from C:\Users\Walter\Documents\Arduino\test_include\test_include.ino:2:

C:\Users\Walter\Documents\Arduino\libraries\wmxzDSP\src/arm_common_tables.h:132:37: error: 'FAST_MATH_TABLE_SIZE' was not declared in this scope

extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1];

in particular the include search order is first
"-IC:\Users\Walter\Documents\arduino-1.8.2\hardware\teensy\avr\cores\teensy3"
followed by
"-IC:\Users\Walter\Documents\Arduino\libraries\wmxzDSP\src"
this fails the compilation as the arm_math.h in cores, which is found first, is an older and incompatible arm_math.h file.
needles to say, if I copy the wmxzDSP/arm_math.h etc. to sketch folder, there are no compilation errors due to local sketch precedence in include search

Suggest, that cores include is placed as last before system, providing include search order: sketch, local libraries, teensyduino libraries, cores, system includes
 
Suggest, that cores include is placed as last before system, providing include search order: sketch, local libraries, teensyduino libraries, cores, system includes

At least on recent versions of Arduino, this stuff is embedded within the arduino-builder program (the part programed in Google Go language). It's not easily changed. Even if it were, making this sort of change would very likely break many libraries that depend on the long-established order.
 
At least on recent versions of Arduino, this stuff is embedded within the arduino-builder program (the part programed in Google Go language). It's not easily changed. Even if it were, making this sort of change would very likely break many libraries that depend on the long-established order.

So what you are saying is that while the link order is
sketch, local libraries, teensyduino libraries, cores, system
the include search order
sketch, cores, local libraries, teensyduino libraries, system
right?

If this is the case, so it be.
OK, I have found a work around that does not require copying arm_math.h to local sketch.
 
At least on recent versions of Arduino, this stuff is embedded within the arduino-builder program (the part programed in Google Go language). It's not easily changed. Even if it were, making this sort of change would very likely break many libraries that depend on the long-established order.

As I was just reading Paul's new GitHub repository https://github.com/PaulStoffregen/Arduino_Dev_List_Topics
So I need to come back to this thread as I would like to enquire what 'the long-established order" of searching include files and linking libraries is?

assume we have
1) sketch directory
2) user (local) libraries
3) teensy libraries
4) cores library
5) system libraries

so, what is the order for 'linking' and what is the order for 'include searches' and where can I find the answer?
 
Status
Not open for further replies.
Back
Top