What can cause this error?
c:/users/frank/.platformio/packages/toolchain-xtensa32/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe:esp32_out.ld:23: ignoring invalid character `#’ in expression
c:/users/frank/.platformio/packages/toolchain-xtensa32/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe:esp32_out.ld:23: syntax error
Compile part is clean. Message gives no hint as to where to look. or what might be wrong. I have 1 global,
i2c_port_t i2c_num; defined in the main module and used in a submodule. I have included
extern i2c_port_t i2c_num;
in its header (.h) file
This may be a red herring but I have tried a number of other possibilities. that don’t go anywhere
Could you take a look at the esp32_out.ld-file in your projects directory? It can be found in your projects directory in the .pioenvs-folder. Just use the windows search function to get the exact path there. Open the file in any texteditor and paste the region around line 23 here.
I encountered the same error… but am not sure what caused it. Nothing special in the code - I was only compiling the included ESP_IDF blink example, and added #define CONFIG_BLINK_GPIO 1 to the top to let it compile.
For some reason… that commented out define snuck in at line 23 - removal of which also made the build complete successfully. I have no idea how that happened - I have been playing around with both the stable and beta versions of platformio, and did edit the default sdkconfig.h it pulls in (to identify which file it was using, and by adding some text to the top header block). I’m not sure if reverting that change made any difference, as I now can’t reproduce this error.
Hopefully this will help anyone else who encounters it - do check the .pioenvs (soon to be .pio\build) and check the line of the esp32_out.ld mentioned in the error - if it’s a commented out define, you can safely remove it and try the build again.
20: * Espressif IoT Development Framework Configuration
23: //#define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1
24: /* If BT is not built at all */
I have experienced that error too some time ago. Seems like whatever is parsing the sdkconfig.h doesn’t like single line comments (//) and only knows how to handle multiline comments (/**/). That is why you get an error if there are single line comments in your sdkconfig.h.