I have a teensy project that was compiling and running but something I did now causes blink.cc to be compiled causing a duplicate setup() and loop() method. I trying to find out where the dependency is and how to remove it. Is there a way to view the makefile or any suggestion on how to track down why blink.cc is being included? Thanks
.pio/build/teensy41/libFrameworkArduino.a(Blink.cc.o): In function setup': Blink.cc:(.text.setup+0x0): multiple definition of
setup’
.pio/build/teensy41/src/main.cpp.o:main.cpp:(.text.setup+0x0): first defined here
/home/greaterebiz/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/5.4.1/…/…/…/…/arm-none-eabi/bin/ld: Disabling relaxation: it will not work with multiple definitions
If blink.cc
is in src
or in the framework files or in a folderi n lib/
and not excluded by src_filter
→ it is compiled. There does not need to be a dependency declared on it.
Based on your error message, blink.cc
and main.cpp
conflict. Remove one of them.
That’s the rub, I cannot find blink.cc or any file remotely named blink in src or lib folders - even looking for hidden files.
It’s possible that this has somehow gotten into the Arudino framework. Open a CLI and do a rm -rf ~/.platformio/packages/framework-arduinoteensy*
to remove all existing Arduino-Teensy packages, then rebuild (framework will be redownloaded).
Ok, i was able to delete the framework-arduinoteensy stuff and as you say when I recompile, it reloades the framework but then I still get the blink.cc problem
Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/framework-arduinoteensy @ ~1.155.0
Unpacking [####################################] 100%
Tool Manager: framework-arduinoteensy @ 1.155.0 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.14.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
- framework-arduinoteensy 1.155.0 (1.55)
- tool-teensy 1.155.0 (1.55)
- toolchain-gccarmnoneeabi 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 96 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <RF24> 1.4.1
| |-- <SPI> 1.0
|-- <EEPROM> 2.0
|-- <Teensy4 I2C> 1.1.0
Building in release mode
Linking .pio/build/teensy41/firmware.elf
.pio/build/teensy41/libFrameworkArduino.a(Blink.cc.o): In function `setup':
Blink.cc:(.text.setup+0x0): multiple definition of `setup'
.pio/build/teensy41/src/main.cpp.o:main.cpp:(.text.setup+0x0): first defined here
/home/greaterebiz/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: Disabling relaxation: it will not work with multiple definitions
collect2: error: ld returned 1 exit status
*** [.pio/build/teensy41/firmware.elf] Error 1
======================================================= [FAILED] Took 4.21 seconds =======================================================
The terminal process "platformio 'run
I think I found it blink.cc was in the framework-ardinoteensy/cores/teens4 folder. Renaming it solved the problem.
Okay that’s weird, I have the same file in my framework-arduinoteensy
folder – I’ll check if building fails for me.
This file is also included in the build for me
Compiling .pio\build\teensy40\FrameworkArduino\Blink.cc.o
but compilation results in a success instead of an error… weird magic. I’ll open an issue about this.
You were a big help - thanks!