- I am using arduino uno r3 & arduino v1.0.6.
- Attached is my code.
- I have tried to add another .c & .h file & to main arduino file.
By error comes saying: undefined reference to function.
code 1.zip (1.26 KB)
code 1.zip (1.26 KB)
Sorry I did not look at the Zip, I am on a tablet.
However, for tabbed .H and .CPP extensions, you must #include "myheaderfile.h"
Note the quotes instead of <myheaderfile.h>
For .INO, they are automatically added.
Here is a multitab working Arduino sketch if you just need a sample. For 1.5.8
SPI-I2C-SD
Ray
Update.... I looked at the Zip this morning. You must name the ".c" to ".cpp" and it should then magically appear in the tabs with the .h when the INO is opened
I have opened your project. But it didn't build. It shows error as I have attached.
Coming back to my code, it have include the header file.
#include "shuffle.h"
but error still comes. i.e undefined reference to function.
Even in main code I have prototyped the function which I am calling.
But still same error
I think i am not able to link arduino .ino files & .c file in which function to be called is defines
error.txt (5.1 KB)
Since the .ino file is compiled as a C++ program, you have to either put swap() in a .cpp file, or explicitly declare it as a C function, usually done like:
#ifdef __cplusplus
extern "C" {
#endif
extern void swap(char *x , char *y);
#ifdef __cplusplus
} // extern "C"
#endif
@westfw , completely missed that
Solved that problem.
note: String& String::operator=(const __FlashStringHelper*)
String & operator = (const __FlashStringHelper *str);
^
Error compiling
plz help me