Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to `sscanf' #404

Closed
cimba007 opened this issue Jun 8, 2015 · 4 comments
Closed

undefined reference to `sscanf' #404

cimba007 opened this issue Jun 8, 2015 · 4 comments

Comments

@cimba007
Copy link

cimba007 commented Jun 8, 2015

void setup() {
    // put your setup code here, to run once:
    int i, ii;
    char* test;
    sscanf(test, "%x", &ii);
}

void loop() {
  // put your main code here, to run repeatedly:

}

Throws this:

C:\Users\Jinja\AppData\Local\Temp\build662335425252246733.tmp\sketch_jun08b.cpp.o:(.text+0x4): undefined reference to `sscanf'
C:\Users\Jinja\AppData\Local\Temp\build662335425252246733.tmp\sketch_jun08b.cpp.o: In function `setup':
sketch_jun08b.cpp:(.text+0x14): undefined reference to `sscanf'
collect2.exe: error: ld returned 1 exit status
Fehler beim Kompilieren.

Pretty straight forward.
Running on 1.6.4-673-g8cd3697

If anybody has a solution this would be very much appreciated

@cimba007 cimba007 changed the title sscanf broken undefined reference to `sscanf' Jun 8, 2015
@me-no-dev
Copy link
Collaborator

os_sprintf(test, "%x", &ii);

@cimba007
Copy link
Author

cimba007 commented Jun 9, 2015

ty, didn't think of these functions. A wrapper would be nice though

@cimba007 cimba007 closed this as completed Jun 9, 2015
@nicjohnston
Copy link

os_sprintf didn't work for me, the watchdog timer triggered a reboot.
This is the code:

void setup() {
  Serial.begin(115200);
  Serial.println("starting");
  char *data = "1234";
  int i = 0;
  os_sprintf(data,"%d", &i);
  Serial.println(i);
}
void loop() { }

When os_sprintf is replaced with sscanf, the compiler throws a undefined reference error.

@a-andreyev
Copy link

os_sprintf(...) is for different purposes!
We should use siscanf(...), but it's not implemented too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants