Hallo Leute,
ich möchte mit meinen ATmega mit Floatingvariablen arbeiten, stosse aber
auf ein Problem, welches ich mittels eines kleinen Programms zeigen
kann:
#include <math.h>
#include <stdio.h>
int main( void )
{
double PI, x;
char s[16];
PI = 4*atan(1);
x = 180/PI * atan2(2,1);
sprintf(s,"x=%f",x);
while( 1 );
return 0;
}
Der Simulator sagt, PI und x seien richtig berechnet. Im String s steht
aber x=?.
Im Manual vom GCC ließt man in der Beschreibung der stdio.h man solle
"-Wl,-u,vfprintf -lprintf_flt -lm"
den Compiler Options hinzufügen.
Ich nehme an, ich finde das unter Project -> Configuration Options ->
Custom Options -> All files.
Aber das bringt keine Änderung. Was mache ich falsch?
Viele Grüße
Stefan
Stefan wrote: > "-Wl,-u,vfprintf -lprintf_flt -lm" > > den Compiler Options hinzufügen. > > Ich nehme an, ich finde das unter Project -> Configuration Options -> > Custom Options -> All files. Nein, das sind Optionen für den Linker, also: Project -> Configuration Options -> Custom Options -> Linker Options
Vielen Dank für die Hilfe. Jetzt geht es. :o) Viele Grüße Stefan
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.