Hi,
I am stuck with a IMHO very simple task.
I am developing a program under mbed-os 6.4 with an mbed LPC1768. It uses CAN, UART and Circular_Buffers.
The program compiles fine when everything is in main.cpp, but as it got overcrowded, I wanted to move functions from this main.cpp to separate source and header files (slcan.c and slcan.h), which I added to the main directory.
I include the header in main.
Here is the function in slcan.c:
// transform hex nibble to ascii char
char hex2asc(char c)
{
c += 30;
if (c > 39) c += 6;
return c;
}
The C-function “hex2asc” that was “exported” this way can not be linked. I get the following error:
Building project empty-example (LPC1768, ARMC6)
Scan: empty-example
Link: empty-example
[Warning] @0,0: L3912W: Option ‘legacyalign’ is deprecated.
[Error] @0,0: L6218E: Undefined symbol hex2asc(char) (referred from BUILD/LPC1768/ARMC6/main.o).
What is the correct way to add source and header files to a project?
Thanks in advance
Andreas