[.pioenvs\seeeduino\firmware.elf] Error 1

This may be a basic mistake as new to platformIO but with standard build for VSC and PIO and using a Seeed Uno I get the above error. It compiles with Ardunio and uploads to the board but not with PIO. Using a serial CAN board attached but don’t think this is the issue as using the files Seed/from github without changes.

Any pointers (excuse the pun) as to what is I’m doing wrong.

The following is the terminal output:

Processing seeeduino (platform: atmelavr; board: seeeduino; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: Atmel AVR > Seeeduino
SYSTEM: ATMEGA328P 16MHz 2KB RAM (31.50KB Flash)
Converting recv.ino
Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
Collected 31 compatible libraries
Scanning dependencies…
Dependency Graph
|-- <private_lib>
|-- 1.0
Compiling .pioenvs\seeeduino\src\recv.ino.cpp.o
Archiving .pioenvs\seeeduino\lib632\libprivate_lib.a
Compiling .pioenvs\seeeduino\lib8df\SoftwareSerial\SoftwareSerial.cpp.o
Archiving .pioenvs\seeeduino\libFrameworkArduinoVariant.a
Compiling .pioenvs\seeeduino\FrameworkArduino\CDC.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\HardwareSerial0.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\IPAddress.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\PluggableUSB.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\Print.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\Stream.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\Tone.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\USBCore.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\WInterrupts.c.o
Archiving .pioenvs\seeeduino\lib8df\libSoftwareSerial.a
Compiling .pioenvs\seeeduino\FrameworkArduino\WMath.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\WString.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\abi.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\hooks.c.o
Compiling .pioenvs\seeeduino\FrameworkArduino\main.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\new.cpp.o
Compiling .pioenvs\seeeduino\FrameworkArduino\wiring.c.o
Compiling .pioenvs\seeeduino\FrameworkArduino\wiring_analog.c.o
Compiling .pioenvs\seeeduino\FrameworkArduino\wiring_digital.c.o
Compiling .pioenvs\seeeduino\FrameworkArduino\wiring_pulse.S.o
Compiling .pioenvs\seeeduino\FrameworkArduino\wiring_pulse.c.o
Compiling .pioenvs\seeeduino\FrameworkArduino\wiring_shift.c.o
Archiving .pioenvs\seeeduino\libFrameworkArduino.a
Linking .pioenvs\seeeduino\firmware.elf
C:\Users\THETRU~1\AppData\Local\Temp\cc6tTYq3.ltrans0.ltrans.o: In function main': <artificial>:(.text.startup+0x104): undefined reference to Serial_CAN::begin(int, int, unsigned long)’
:(.text.startup+0x128): undefined reference to `Serial_CAN::recv(unsigned long*, unsigned char*)’
collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\seeeduino\firmware.elf] Error 1

Code files and platformio.ini please.

Hi, thanks for looking at this. Hope the following is all you need as the two include files are rather large to past here.



; PlatformIO Project Configuration File
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
; Please visit documentation for the other options and examples
platform = atmelavr
board = seeeduino
framework = arduino

Code files:

// unsigned char recv(unsigned long *id, uchar *buf);
// SUPPORT: joney.sui@longan-labs.cc
#include <Serial_CAN_Module.h>
#include <SoftwareSerial.h>

Serial_CAN can;

#define can_tx  2           // tx of serial can module connect to D2
#define can_rx  3           // rx of serial can module connect to D3

void setup()
    can.begin(can_tx, can_rx, 9600);      // tx, rx

unsigned long id = 0;
unsigned char dta[8];

// send(unsigned long id, byte ext, byte rtrBit, byte len, const byte *buf);
void loop()
    if(can.recv(&id, dta))
        Serial.print("GET DATA FROM ID: ");
        for(int i=0; i<8; i++)
            Serial.print(dta[i], HEX);


I also get this each time platformio is started.

Conflicted extensions with IntelliSense service were detected (Arduino). Code-completion, linting and navigation will not work properly. Please disable or uninstall them.

I think the only extension I have installed is Cobalt2. I notice that Microsoft Ardunio extension is installed which I assume is from the initial install of VSC. Is this what has to be removed?

UPDATE: Yes it was the extension to remove. But now each time I start VSC/PIO it says that this extension is recommended because of the file types in-use. Oh well more reading to do…

I am assuming the Serial_CAN_Module.h comes from here (GitHub - Longan-Labs/Serial_CAN_Arduino). This library is not yet registered in PIO’s registry (here). But you can still tell PIO to just clone the repo and try to build it. Which works.

Change your platformio.ini to

platform = atmelavr
board = seeeduino
framework = arduino
lib_deps =

and retry.

Should give

DATA:    [==        ]  15.9% (used 326 bytes from 2048 bytes)
PROGRAM: [=         ]  12.7% (used 4088 bytes from 32256 bytes)
 [SUCCESS] Took 17.70 seconds 

Thanks. I’ll try when next in front of the machine. I had included the two files in the private lib, thus lib\private_lib as indicated in other posts.

Works here also. Thanks.

Hi Max, for the uneducated, me, why did putting the two files into the private library fail? Obviously the system finds them and uses them. Is there something else I should have done to use the private lib feature?
Anyway thanks for your help. Andy

Can you upload your whole project with the needed steps to reproduce it?

Not sure how I upload the whole project. The lib file I have in the \lib\private_lib folder is this:

#include <Arduino.h>
#define uchar unsigned char

#define CAN_RATE_5 1
#define CAN_RATE_10 2
#define CAN_RATE_20 3
#define CAN_RATE_25 4
#define CAN_RATE_31_2 5
#define CAN_RATE_33 6
#define CAN_RATE_40 7
#define CAN_RATE_50 8
#define CAN_RATE_80 9
#define CAN_RATE_83_3 10
#define CAN_RATE_95 11
#define CAN_RATE_100 12
#define CAN_RATE_125 13
#define CAN_RATE_200 14
#define CAN_RATE_250 15
#define CAN_RATE_500 16
#define CAN_RATE_666 17
#define CAN_RATE_1000 18

class Serial_CAN
unsigned char cmdOk(char *cmd);
unsigned char enterSettingMode();
unsigned char exitSettingMode();
void clear();
char str_tmp[100];

void begin(int can_tx, int can_rx, unsigned long baud);
unsigned char send(unsigned long id, uchar ext, uchar rtrBit, uchar len, const uchar *buf);
unsigned char recv(unsigned long *id, uchar *buf);

unsigned char canRate(unsigned char rate);
unsigned char baudRate(unsigned char rate);

unsigned char setMask(unsigned long *dta);
unsigned char setFilt(unsigned long *dta);

unsigned char factorySetting();
void debugMode();


The project file is that listed in a previous post.

Hmm, think I have spotted my problem. The project file has the flowing includes:
#include <Serial_CAN_Module.h>
#include <SoftwareSerial.h>
As there was only the one file named Serial_CAN_Module.h in the repository I only included that particular file in the private lib. However there is another file included in the repository named Serial_CAN_Module.cpp . If I include both files PIO is happy. Not quite sure why that works, but I’m still on a learning curve.

Thanks for you help. Andy

Oh. Now your error makes sense.

Means that you declare that method / class to exist via a header file but there was no CPP file implementing the actual class / function. So if you don’t compile the actual .cpp containing the function code, you will get that error. Didn’t read that carefully enough.