programm läßt sich mit altem gcc nicht übersetzen
-
Hallo
Ich kann mein Programm mit debian sarge und 3.3.5 ohne Probleme übersetzen.Nun muss ich aber leider das ganze dringend auf einem debian woody system mit gcc-2.95 übersetzen.
Dabei bekomme ich einige Probleme.
- mein woody kennt den Befehl nice() nicht. Ist das nicht stdlib ?
++ -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -c -o binaar.o `test -f 'binaar.cpp' || echo './'`binaar.cpp binaar.cpp: In function `int main(int, char **)': binaar.cpp:51: implicit declaration of function `int nice(...)' make[2]: *** [binaar.o] Error 1Das kann ich aber noch rausnehmen.
Dann geht es aber los.
g++ -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -c -o algo.o `test -f 'algo.cpp' || echo './'`algo.cpp algo.cpp: In method `void Algo::sort()': algo.cpp:66: no matching function for call to `Algo::sort (TResult *, TResult *, bool (&)(const TResult &, const TResult &))' algo.cpp:63: candidates are: void Algo::sort() algo.cpp:67: implicit declaration of function `int unique(...)' algo.cpp:67: assignment to `TResult *' from `int' lacks a cast make[2]: *** [algo.o] Error 1 make[2]: Leaving directory `/root/binaar/src'Der Code der den Fehler verursacht ist der folgende:
#include "algo.h" #include <iostream> Algo::Algo(const char* path) { firstpassdone = false; lpath = path; } /** * This Function returns a result of an algo by given number. * if the number is higher then posible or less 0 then the result is null * @param number: Number of the result * @return TResult */ TResult Algo::getResult(uint number) { if (number >= 0 && number < result.size()) { return result[number]; } else { TResult tmp; tmp.frame = -1; return tmp; } } bool Compare(const TResult &a, const TResult &b) { return a.frame < b.frame; } bool Unique(const TResult &a, const TResult &b) { return a.frame == b.frame; } void Algo::sort() { if (!result.empty()) { std::vector<TResult>::iterator newEnd; std::sort(result.begin(),result.end(),Compare); newEnd = std::unique(result.begin(),result.end(),Unique); result.erase(newEnd, result.end()); } }(in Bunt http://phpfi.com/78511)
Ich vermute mal das es an den Namespaces liegt.
alte gcc Versionen sollen da etwas eigen sein.
Mehr Infos habe ich dazu jedoch nicht.
Kann mir da jemand einen Tip geben?
Ist leider echt dringend!! BITTE
-
Hallo,
sieht so aus als hättest du <algorithm> nicht inkludiert.
-
hast recht.
Das war es.
Nur komisch das es mit gcc3 geht.Naja nun geht es auch unter woody