Hi
I am using PIO via CLion. I have an Arduino project on an SAMD21 processor.
My directory structure is:
platformio.ini
/src/main.cpp
/lib/network_functions
--network_functions.cpp
--network_functions.h
/include
--TypesAndDefs.h
--secrets.h
--debug.h
When I compile I get linker errors for functions in network_functions.cpp
Linking .pio\build\adafruit_feather_m0\firmware.elf
c:/users/tom/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\adafruit_feather_m0\src\main.cpp.o: in function `loop':
main.cpp:(.text.loop+0x1a): undefined reference to `connectToServer(WiFiClient*, char const*, unsigned short, unsigned int)'
c:/users/tom/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: main.cpp:(.text.loop+0x56): undefined reference to `sendData(WiFiClient*, unsigned char volatile*, unsigned int)'
c:/users/tom/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\adafruit_feather_m0\lib06c\libnetwork_functions.a(network_functions.cpp.o): in function `connectToNetwork(WiFiClass*)':
network_functions.cpp:(.text._Z16connectToNetworkP9WiFiClass+0x30): undefined reference to `scanForUnencryptedNetworks(char (*) [32], WiFiClass*)'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\adafruit_feather_m0\firmware.elf] Error 1
========================== [FAILED] Took 6.91 seconds ==========================
I understand that cpp files in lib should get compiled automatically and I shouldn’t have to change the platformio.ini file.
Thanks