-->
Page 2 of 2

Re: Not able to use functions from user_interface.h

PostPosted: Thu Oct 06, 2016 2:13 pm
by martinayotte
Before I've sent my previous post, I've already figured out that your issue is at linking time, that is why I've answered. You absolutely need to have the include done inside an extern "C", otherwise you have linking problem between C and C++.

Re: Not able to use functions from user_interface.h

PostPosted: Thu Oct 06, 2016 5:15 pm
by lsk123
Thanks martinayotte. I finally figured it out: the slober (eclipseArduino 3.1) plugin generates a file .ino.cpp every time a project is built. That's where the declaration needs to change.

I also had to disable wdt in the run loop, otherwise it was resetting the board.
I had no such problem with Arduino IDE.

Hope it helps whoever is going through the same pain.

Re: Not able to use functions from user_interface.h

PostPosted: Wed Jan 11, 2017 10:47 am
by Xoyce
Sorry, but I did not understand what the final solution was with this problem? I am having basically the same issue here:

Code: Select allextern "C" {
#include "user_interface.h"
}

void setup() {
   Serial.begin(115200);
}

void loop() {

   Serial.print("system_get_sdk_version(): ");
   Serial.println(system_get_sdk_version());

   delay(1000);
}



at compile time I get:
Code: Select all.ino:9: undefined reference to `system_get_sdk_version()'


EDIT:
I figured. You can avoid this error by creating another header file and puting extern "C" in there.
Code: Select allextern "C" {
#include "user_interface.h"
}