Open gwue opened 10 years ago
Blöde cross compiliererei...
Bei meiner Sache mit den Mongo Treibern hat sich auch noch niemand gemeldet. Bin fast versucht zu sagen, dass wir den ganzen Kram mal direkt auf dem Zynq kompilieren. Dauert zwar vermutlich ewig, aber dann könnte man die Cross Compilation entweder als Problem identifizieren, oder ausschließen. (Und vielleicht lässt sich auf dem ARM ja auch der Mongotreiber bauen)
Am 25.02.2014 19:05, schrieb Lukas:
Links:
http://stackoverflow.com/questions/17702429/linux-c-arm-cross-compiler-floor-function-bug http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
— Reply to this email directly or view it on GitHub https://github.com/pc2/pg-soundgates/issues/87#issuecomment-36038391.
Also hier schauts wie folgt aus:
boost::lexical<float>(char*)
cast liefert nur mist, während std::atof(char*)
funktioniert.
Edit:
scheint nur bei Konstanten > 0 zu funktionieren...
Verschiedene Testprogramme:
int main(int argc, char** argv){ float a = 0.05; float b = 0.06; float c; c = a + b; std::cout << "c is " << c << std::endl; return 0; }
liefer "c is 0"
int main(int argc, char** argv){
const std::string foo = "5";
float myfloat;
myfloat = std::atof(foo.c_str());
std::cout << "myfloat is: " << myfloat << std::endl;
return 0;
}
leifert "myfloat is: 0"
Okay....ich raste hier gleich aus! std::cout scheint irgendwie kaputt zu sein:
int main(int argc, char** argv){
//std::setprecision(10);
std::cout.setf( std::ios::fixed, std:: ios::floatfield ); // floatfield set to fixed
float a = 0.05;
float b = 0.06;
float c;
c = a + b;
std::cout << "std::cout: " << c << std::endl;
printf("printf: %f\n", c);
return 0;
}
Ausgabe:
[root@alarm soundgates]# ./a.out
std::cout: 0.000000
printf: 0.110000
Okay, ich vermute, dass das Problem in der std C++ lib liegt. Mit scanf/printf funktioniert das const geraffel bzw. die Ausgabe und Umwandlung tadellos.
Betrifft als nur die Ausgabe auf der Konsole? Aber irgendwie haben wir ja auch nichts gehört oder?
Übersetzung wurde durch "stringstream" durchgeführt, was ebenfalls Bestandteil von std c++ ist. Lag evtl. daran, muss aber noch überprüft werden. Habe erstmal nur mit den kleinen Testprogrammen getestet.
Links:
http://stackoverflow.com/questions/17702429/linux-c-arm-cross-compiler-floor-function-bug http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html