Win-Programm kompiliert nicht unter Ubuntu (gcc)



  • Hallo,

    ich habe folgendes Programm unter Windows geschrieben und dort funktioniert es auch perfekt.

    #include <fstream>
    #include <vector>
    #include <limits>
    #include <iostream>
    #include <string>
    #include <complex>
    #include <windows.h >
    #include <stdio.h>
    #include <stdlib.h>
    
    using namespace std;
    //testet, ob das was jetzt im stream kommt ein "<tag attributeName" ist und ließt bis direkt dahinter.
    bool isAttributeTag(ifstream& f,const char* tag, const char* attributeName){
        string token;
        if(f.get() != '<')
            return false;
        f >> token;
        if (token != tag)
            return false;
        f >> token;
    
        return token == attributeName;
    }
    
    //gibt den Wert des Attributs zurück
    size_t getIndepSize(const char* filename,const char* attributeName){
        ifstream f(filename);
        while ( f )
        {
            if(isAttributeTag(f,"indep",attributeName)){
                size_t value;
                f >> value;
                return value;
            }
            f.ignore( numeric_limits< streamsize >::max(), '\n' );
        }
        return -1;
    }
    
    //ließt alle Werte nach <tag attributeName ....>
    vector<complex<double> > readComplexNumbers(const char* filename,const char* tag, const char* attributeName, int anzahl){
        vector<complex<double> > complexNumbers(anzahl);
        ifstream f(filename);         
    
            //solange Zeilen ignorieren, bis der Tag gefunden wurde
        while(!isAttributeTag(f,tag,attributeName)){
            f.ignore( numeric_limits< streamsize >::max(), '\n' );
        }
            //die Zeile des Tags ebenso ignorieren
        f.ignore( numeric_limits< streamsize >::max(), '\n' );
    
            //nun Werte lesen
        string s;  
        double real, imag;
        char plus, j; 
        for(int p=0; p<anzahl; p++){
            getline(f, s);
            stringstream ss(s);
            if(s.size() > 22){
                 ss>>real>>plus>>j>>imag;
                 if(plus == '-'){
                    imag *= -1;
                 }              
            }
            else{
                 ss>>real;
                 imag=0;                
            }
            complexNumbers[p]=complex<double>(real,imag);
        } 
        return complexNumbers; 
    }
    //ließt alle Werte nach <tag attributeName ....>
    vector<double> readValues(const char* filename,const char* tag, const char* attributeName){
        vector<double> values;
        ifstream f(filename);
    
            //solange Zeilen ignorieren, bis der Tag gefunden wurde
        while(!isAttributeTag(f,tag,attributeName)){
            f.ignore( numeric_limits< streamsize >::max(), '\n' );
        }
            //die Zeile des Tags ebenso ignorieren
        f.ignore( numeric_limits< streamsize >::max(), '\n' );
    
            //nun Werte lesen
        double value = 0;
        while ( f >> value){
            values.push_back(value);
        }
        return values;
    } 
    
    vector<double> readCSV(const char* filename,int wspalte)
    {
        ifstream in(filename);
        vector<double> ergebnis;
        string zeile;
        while (getline(in, zeile)){
                   stringstream zeilenparser(zeile);
                   for (int i = 0; i < wspalte; ++i){
                       zeilenparser.ignore(zeile.length(), ';');
                       }
                   double wert = 0;
                   if (zeilenparser >> wert){
                      ergebnis.push_back(wert);
                      }
                   }
        return ergebnis;
    }
    
    int ChangeData(const char* filename,string data, double wert){
           fstream f(filename);
            string s;
    
            stringstream ss, aa;
            aa <<wert;
            string value = aa.str(); 
    
            ss <<"temp.txt";
            string filen = ss.str();
            ofstream fout;
            fout.open(filen.c_str(), ios::trunc);   
            while(getline(f, s)){
                    size_t such = s.find(data);
                    if(such != string::npos){                 // Die richtige Stelle finden
                            size_t abg1 = s.find('"', such);       // Von dieser Stelle aus das nächste " ... " suchen                    
                            size_t abg2 = s.find('"', abg1+1);
                            int laenge = abg2-abg1-1;                                  // Alles zwischen " ... " löschen
                            s = s.erase ( abg1+1, laenge );
                            s = s.insert ( abg1+1, value );                         // Neue Zahl zwischen " ... " einfügen
                            }
                    fout<<s<<endl;                                             
                    }   
                    fout.close(); 
                    return 1;     
    }          
    
    int simNet(const char* filename){
        stringstream ss;
        ss <<"qucsator -b -i " <<filename <<" -o ready.dat";
        string program = ss.str();
        cout<<program;
        system(program.c_str());
        return 1;
    }
    int main(int argc, char *argv[])
    {
    // Kostante Werte auslesen
        size_t frequencies;
        size_t phases;
        size_t uqs;
        int ganzahl;
        double var;
        vector<double> uq;
        stringstream ss; 
        ss <<"FERTIG.csv";
        string filen = ss.str();
        ofstream fout;
        fout.open(filen.c_str(), ios::trunc); 
    // Werte aus CSV-Datei auslesen und in r,c,u speichern
        vector<double> r = readCSV("ready.csv", 7);
        vector<double> c = readCSV("ready.csv", 9);
        vector<double> u = readCSV("ready.csv", 8);
    // Schleife
        for(int i=0; i < 200; i++){
                cout<<"\n"<<"Durchlauf "<<i+1<<"\n"<<"\n";
        // Netzlist öffnen und Werte ändern
                ChangeData("ready.txt", "R:R1", r[i]);
                ChangeData("ready.txt", "R:R2", r[i]*10);
                ChangeData("ready.txt", "R:R3", r[i]);
                ChangeData("ready.txt", "Vac:V3", u[i]);
                ChangeData("ready.txt", "Vac:V4", u[i]); 
                ChangeData("ready.txt", "C:C1", c[i]);            
                ChangeData("ready.txt", "C:C2", c[i]);   
                ChangeData("ready.txt", "C:C3", c[i]*10);              
       // Netzliste simulieren
                simNet("temp.txt");  
         //                    Sleep(5000);
        // Werte mitteln
              if(i==0){
                        frequencies = getIndepSize("ready.dat","acfrequency");
                        phases = getIndepSize("ready.dat","phase_urm_var");
                        uqs = getIndepSize("ready.dat","uq");
                        ganzahl = phases*frequencies*uqs;
                        var = phases*frequencies;
                        uq = readValues("ready.dat","indep","uq");
                        for(size_t q=0; q<uqs; q++){
                                fout<<uq[q];
                                if(q!=uqs){
                                           fout<<";";
                                }
                        }
                        fout<<endl;
                 }
                vector<complex<double> > ua = readComplexNumbers("ready.dat","dep","Pr2.v",ganzahl); // Spannungsverstärker
                vector<complex<double> > ub = readComplexNumbers("ready.dat","dep","Pr3.v",ganzahl); // Ladungsverstärker
                vector<double> ureadya(uqs);
                vector<double> ureadyb(uqs);
                for(size_t i = 0; i != uqs;++i){
                           complex<double> uvara (0,0);
                           complex<double> uvarb (0,0);
                           for(size_t j = (i*var); j != ((i+1)*var);j++){                  
                                         uvara += ua[j]; 
                                         uvarb += ub[j];         
                           }                              
                           ureadya[i] = abs(uvara / var);
                           ureadyb[i] = abs(uvarb / var);
                           }
                for(size_t q=0; q<uqs; q++){
                        fout<<ureadya[q];
                        if(q!=uqs){
                                   fout<<";";
                        }
                }
                fout<<endl;
                for(size_t q=0; q<uqs; q++){
                        fout<<ureadyb[q];
                        if(q!=uqs){
                                   fout<<";";
                        }
                }
                fout<<endl;  
    }
        fout.close();         
    // Dos Fenster nicht schließen
        cin.get();
        cin.get(); 
        }
    

    Unter Linux erhalte ich nach dem Befehl gcc... folgende Fehlermeldungen:

    /tmp/cc6hZUsU.o: In function `isAttributeTag(std::basic_ifstream<char,
    std::char_traits<char> >&, char const*, char const*)':
    ready.cpp:(.text+0x1f): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string()'
    ready.cpp:(.text+0x2b): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >::get()'
    ready.cpp:(.text+0x4f): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >&
    std::operator>><char, std::char_traits<char>, std::allocator<char>
    >(std::basic_istream<char, std::char_traits<char> >&,
    std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >&)'
    ready.cpp:(.text+0x80): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >&
    std::operator>><char, std::char_traits<char>, std::allocator<char>
    >(std::basic_istream<char, std::char_traits<char> >&,
    std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >&)'
    ready.cpp:(.text+0xa8): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0xc2): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    /tmp/cc6hZUsU.o: In function `getIndepSize(char const*, char const*)':
    ready.cpp:(.text+0x116): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::basic_ifstream(char const*, std::_Ios_Openmode)'
    ready.cpp:(.text+0x150): undefined reference to
    `std::basic_istream<char, std::char_traits<char>
    >::operator>>(unsigned long&)'
    ready.cpp:(.text+0x178): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >::ignore(long, int)'
    ready.cpp:(.text+0x18d): undefined reference to `std::basic_ios<char,
    std::char_traits<char> >::operator void*() const'
    ready.cpp:(.text+0x1b4): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::~basic_ifstream()'
    ready.cpp:(.text+0x1d1): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::~basic_ifstream()'
    /tmp/cc6hZUsU.o: In function `readComplexNumbers(char const*, char
    const*, char const*, int)':
    ready.cpp:(.text+0x2a7): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::basic_ifstream(char const*, std::_Ios_Openmode)'
    ready.cpp:(.text+0x2ea): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >::ignore(long, int)'
    ready.cpp:(.text+0x330): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >::ignore(long, int)'
    ready.cpp:(.text+0x33f): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string()'
    ready.cpp:(.text+0x367): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >& std::getline<char,
    std::char_traits<char>, std::allocator<char>
    >(std::basic_istream<char, std::char_traits<char> >&,
    std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >&)'
    ready.cpp:(.text+0x391): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::basic_stringstream(std::basic_string<char,
    std::char_traits<char>, std::allocator<char> > const&,
    std::_Ios_Openmode)'
    ready.cpp:(.text+0x3a0): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::size() const'
    ready.cpp:(.text+0x3c4): undefined reference to
    `std::basic_istream<char, std::char_traits<char>
    >::operator>>(double&)'
    ready.cpp:(.text+0x3d6): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >&
    std::operator>><char, std::char_traits<char>
    >(std::basic_istream<char, std::char_traits<char> >&, char&)'
    ready.cpp:(.text+0x3e8): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >&
    std::operator>><char, std::char_traits<char>
    >(std::basic_istream<char, std::char_traits<char> >&, char&)'
    ready.cpp:(.text+0x3fa): undefined reference to
    `std::basic_istream<char, std::char_traits<char>
    >::operator>>(double&)'
    ready.cpp:(.text+0x43c): undefined reference to
    `std::basic_istream<char, std::char_traits<char>
    >::operator>>(double&)'
    ready.cpp:(.text+0x4aa): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    ready.cpp:(.text+0x4c1): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    ready.cpp:(.text+0x4f6): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x50d): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x524): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::~basic_ifstream()'
    ready.cpp:(.text+0x53b): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::~basic_ifstream()'
    /tmp/cc6hZUsU.o: In function `readValues(char const*, char const*,
    char const*)':
    ready.cpp:(.text+0x5ea): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::basic_ifstream(char const*, std::_Ios_Openmode)'
    ready.cpp:(.text+0x60b): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >::ignore(long, int)'
    ready.cpp:(.text+0x651): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >::ignore(long, int)'
    ready.cpp:(.text+0x68d): undefined reference to
    `std::basic_istream<char, std::char_traits<char>
    >::operator>>(double&)'
    ready.cpp:(.text+0x6a6): undefined reference to `std::basic_ios<char,
    std::char_traits<char> >::operator void*() const'
    ready.cpp:(.text+0x6bf): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::~basic_ifstream()'
    ready.cpp:(.text+0x6d6): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::~basic_ifstream()'
    /tmp/cc6hZUsU.o: In function `readCSV(char const*, int)':
    ready.cpp:(.text+0x772): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::basic_ifstream(char const*, std::_Ios_Openmode)'
    ready.cpp:(.text+0x78c): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string()'
    ready.cpp:(.text+0x7bb): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::basic_stringstream(std::basic_string<char,
    std::char_traits<char>, std::allocator<char> > const&,
    std::_Ios_Openmode)'
    ready.cpp:(.text+0x7d6): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::length() const'
    ready.cpp:(.text+0x7f0): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >::ignore(long, int)'
    ready.cpp:(.text+0x82f): undefined reference to
    `std::basic_istream<char, std::char_traits<char>
    >::operator>>(double&)'
    ready.cpp:(.text+0x848): undefined reference to `std::basic_ios<char,
    std::char_traits<char> >::operator void*() const'
    ready.cpp:(.text+0x876): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    ready.cpp:(.text+0x88d): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    ready.cpp:(.text+0x8ae): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >& std::getline<char,
    std::char_traits<char>, std::allocator<char>
    >(std::basic_istream<char, std::char_traits<char> >&,
    std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >&)'
    ready.cpp:(.text+0x8c7): undefined reference to `std::basic_ios<char,
    std::char_traits<char> >::operator void*() const'
    ready.cpp:(.text+0x8e4): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x8fb): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x912): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::~basic_ifstream()'
    ready.cpp:(.text+0x956): undefined reference to
    `std::basic_ifstream<char, std::char_traits<char>
    >::~basic_ifstream()'
    /tmp/cc6hZUsU.o: In function `ChangeData(char const*,
    std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >, double)':
    ready.cpp:(.text+0x9d4): undefined reference to
    `std::basic_fstream<char, std::char_traits<char> >::basic_fstream(char
    const*, std::_Ios_Openmode)'
    ready.cpp:(.text+0x9e3): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string()'
    ready.cpp:(.text+0xa05): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::basic_stringstream(std::_Ios_Openmode)'
    ready.cpp:(.text+0xa27): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::basic_stringstream(std::_Ios_Openmode)'
    ready.cpp:(.text+0xa42): undefined reference to
    `std::basic_ostream<char, std::char_traits<char>
    >::operator<<(double)'
    ready.cpp:(.text+0xa5b): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::str() const'
    ready.cpp:(.text+0xa73): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0xa8c): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::str() const'
    ready.cpp:(.text+0xa9b): undefined reference to
    `std::basic_ofstream<char, std::char_traits<char> >::basic_ofstream()'
    ready.cpp:(.text+0xaaa): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::c_str() const'
    ready.cpp:(.text+0xac4): undefined reference to
    `std::basic_ofstream<char, std::char_traits<char> >::open(char const*,
    std::_Ios_Openmode)'
    ready.cpp:(.text+0xae7): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::find(std::basic_string<char, std::char_traits<char>,
    std::allocator<char> > const&, unsigned long) const'
    ready.cpp:(.text+0xb17): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::find(char, unsigned long) const'
    ready.cpp:(.text+0xb3d): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::find(char, unsigned long) const'
    ready.cpp:(.text+0xb89): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::erase(unsigned long, unsigned long)'
    ready.cpp:(.text+0xb9e): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::operator=(std::basic_string<char, std::char_traits<char>,
    std::allocator<char> > const&)'
    ready.cpp:(.text+0xbc2): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::insert(unsigned long, std::basic_string<char,
    std::char_traits<char>, std::allocator<char> > const&)'
    ready.cpp:(.text+0xbd7): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::operator=(std::basic_string<char, std::char_traits<char>,
    std::allocator<char> > const&)'
    ready.cpp:(.text+0xbf0): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <char, std::char_traits<char>, std::allocator<char>
    >(std::basic_ostream<char, std::char_traits<char> >&,
    std::basic_string<char, std::char_traits<char>, std::allocator<char> >
    const&)'
    ready.cpp:(.text+0xbf5): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
    std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&)'
    ready.cpp:(.text+0xbfd): undefined reference to
    `std::basic_ostream<char, std::char_traits<char>
    >::operator<<(std::basic_ostream<char, std::char_traits<char> >&
    (*)(std::basic_ostream<char, std::char_traits<char> >&))'
    ready.cpp:(.text+0xc16): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >& std::getline<char,
    std::char_traits<char>, std::allocator<char>
    >(std::basic_istream<char, std::char_traits<char> >&,
    std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >&)'
    ready.cpp:(.text+0xc2f): undefined reference to `std::basic_ios<char,
    std::char_traits<char> >::operator void*() const'
    ready.cpp:(.text+0xc4c): undefined reference to
    `std::basic_ofstream<char, std::char_traits<char> >::close()'
    ready.cpp:(.text+0xc60): undefined reference to
    `std::basic_ofstream<char, std::char_traits<char>
    >::~basic_ofstream()'
    ready.cpp:(.text+0xc76): undefined reference to
    `std::basic_ofstream<char, std::char_traits<char>
    >::~basic_ofstream()'
    ready.cpp:(.text+0xc8d): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0xca3): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0xcba): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0xcd0): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0xce7): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    ready.cpp:(.text+0xcfd): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    ready.cpp:(.text+0xd14): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    ready.cpp:(.text+0xd2a): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    ready.cpp:(.text+0xd41): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0xd57): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0xd6e): undefined reference to
    `std::basic_fstream<char, std::char_traits<char> >::~basic_fstream()'
    ready.cpp:(.text+0xd95): undefined reference to
    `std::basic_fstream<char, std::char_traits<char> >::~basic_fstream()'
    /tmp/cc6hZUsU.o: In function `simNet(char const*)':
    ready.cpp:(.text+0xdeb): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::basic_stringstream(std::_Ios_Openmode)'
    ready.cpp:(.text+0xe03): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0xe15): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0xe22): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0xe38): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::str() const'
    ready.cpp:(.text+0xe44): undefined reference to `std::cout'
    ready.cpp:(.text+0xe49): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <char, std::char_traits<char>, std::allocator<char>
    >(std::basic_ostream<char, std::char_traits<char> >&,
    std::basic_string<char, std::char_traits<char>, std::allocator<char> >
    const&)'
    ready.cpp:(.text+0xe55): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::c_str() const'
    ready.cpp:(.text+0xe6e): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0xe81): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0xe98): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    ready.cpp:(.text+0xeba): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    /tmp/cc6hZUsU.o: In function `main':
    ready.cpp:(.text+0xf23): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::basic_stringstream(std::_Ios_Openmode)'
    ready.cpp:(.text+0xf3b): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0xf54): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::str() const'
    ready.cpp:(.text+0xf63): undefined reference to
    `std::basic_ofstream<char, std::char_traits<char> >::basic_ofstream()'
    ready.cpp:(.text+0xf72): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::c_str() const'
    ready.cpp:(.text+0xf8c): undefined reference to
    `std::basic_ofstream<char, std::char_traits<char> >::open(char const*,
    std::_Ios_Openmode)'
    ready.cpp:(.text+0xff9): undefined reference to `std::cout'
    ready.cpp:(.text+0xffe): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0x100b): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0x1015): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
    ready.cpp:(.text+0x1022): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0x102f): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0x1065): undefined reference to
    `std::allocator<char>::allocator()'
    ready.cpp:(.text+0x1080): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string(char const*, std::allocator<char> const&)'
    ready.cpp:(.text+0x10ab): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x10c1): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x10d8): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x111e): undefined reference to
    `std::allocator<char>::allocator()'
    ready.cpp:(.text+0x1139): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string(char const*, std::allocator<char> const&)'
    ready.cpp:(.text+0x114f): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x1185): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x119b): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x11b2): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x11e8): undefined reference to
    `std::allocator<char>::allocator()'
    ready.cpp:(.text+0x1203): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string(char const*, std::allocator<char> const&)'
    ready.cpp:(.text+0x1219): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x124f): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x1265): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x127c): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x12b2): undefined reference to
    `std::allocator<char>::allocator()'
    ready.cpp:(.text+0x12cd): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string(char const*, std::allocator<char> const&)'
    ready.cpp:(.text+0x12e3): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x1319): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x132f): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x1346): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x137c): undefined reference to
    `std::allocator<char>::allocator()'
    ready.cpp:(.text+0x1397): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string(char const*, std::allocator<char> const&)'
    ready.cpp:(.text+0x13ad): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x13e3): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x13f9): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x1410): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x1446): undefined reference to
    `std::allocator<char>::allocator()'
    ready.cpp:(.text+0x1461): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string(char const*, std::allocator<char> const&)'
    ready.cpp:(.text+0x1477): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x14ad): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x14c3): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x14da): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x1510): undefined reference to
    `std::allocator<char>::allocator()'
    ready.cpp:(.text+0x152b): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string(char const*, std::allocator<char> const&)'
    ready.cpp:(.text+0x1541): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x1577): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x158d): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x15a4): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x15ea): undefined reference to
    `std::allocator<char>::allocator()'
    ready.cpp:(.text+0x1605): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::basic_string(char const*, std::allocator<char> const&)'
    ready.cpp:(.text+0x161b): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x1651): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x1667): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x167e): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x169e): undefined reference to
    `std::allocator<char>::~allocator()'
    ready.cpp:(.text+0x17f3): undefined reference to
    `std::basic_ostream<char, std::char_traits<char>
    >::operator<<(double)'
    ready.cpp:(.text+0x1817): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0x1840): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
    std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&)'
    ready.cpp:(.text+0x1848): undefined reference to
    `std::basic_ostream<char, std::char_traits<char>
    >::operator<<(std::basic_ostream<char, std::char_traits<char> >&
    (*)(std::basic_ostream<char, std::char_traits<char> >&))'
    ready.cpp:(.text+0x1c55): undefined reference to
    `std::basic_ostream<char, std::char_traits<char>
    >::operator<<(double)'
    ready.cpp:(.text+0x1c79): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0x1ca2): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
    std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&)'
    ready.cpp:(.text+0x1caa): undefined reference to
    `std::basic_ostream<char, std::char_traits<char>
    >::operator<<(std::basic_ostream<char, std::char_traits<char> >&
    (*)(std::basic_ostream<char, std::char_traits<char> >&))'
    ready.cpp:(.text+0x1ce3): undefined reference to
    `std::basic_ostream<char, std::char_traits<char>
    >::operator<<(double)'
    ready.cpp:(.text+0x1d07): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
    <std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&, char const*)'
    ready.cpp:(.text+0x1d30): undefined reference to
    `std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
    std::char_traits<char> >(std::basic_ostream<char,
    std::char_traits<char> >&)'
    ready.cpp:(.text+0x1d38): undefined reference to
    `std::basic_ostream<char, std::char_traits<char>
    >::operator<<(std::basic_ostream<char, std::char_traits<char> >&
    (*)(std::basic_ostream<char, std::char_traits<char> >&))'
    ready.cpp:(.text+0x1e17): undefined reference to
    `std::basic_ofstream<char, std::char_traits<char> >::close()'
    ready.cpp:(.text+0x1e1c): undefined reference to `std::cin'
    ready.cpp:(.text+0x1e21): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >::get()'
    ready.cpp:(.text+0x1e26): undefined reference to `std::cin'
    ready.cpp:(.text+0x1e2b): undefined reference to
    `std::basic_istream<char, std::char_traits<char> >::get()'
    ready.cpp:(.text+0x1ec1): undefined reference to
    `std::basic_ofstream<char, std::char_traits<char>
    >::~basic_ofstream()'
    ready.cpp:(.text+0x1ed7): undefined reference to
    `std::basic_ofstream<char, std::char_traits<char>
    >::~basic_ofstream()'
    ready.cpp:(.text+0x1eee): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x1f04): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()'
    ready.cpp:(.text+0x1f1b): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    ready.cpp:(.text+0x1f31): undefined reference to
    `std::basic_stringstream<char, std::char_traits<char>,
    std::allocator<char> >::~basic_stringstream()'
    /tmp/cc6hZUsU.o: In function
    `__static_initialization_and_destruction_0(int, int)':
    ready.cpp:(.text+0x1fb8): undefined reference to `std::ios_base::Init::Init()'
    ready.cpp:(.text+0x1fbd): undefined reference to `std::ios_base::Init::~Init()'
    /tmp/cc6hZUsU.o: In function `std::__complex_abs(doublecomplex )':
    ready.cpp:(.text._ZSt13__complex_absCd[std::__complex_abs(doublecomplex
    )]+0x2d): undefined reference to `cabs'
    /tmp/cc6hZUsU.o: In function `bool std::operator==<char,
    std::char_traits<char>, std::allocator<char> >(std::basic_string<char,
    std::char_traits<char>, std::allocator<char> > const&, char const*)':
    ready.cpp:(.text._ZSteqIcSt11char_traitsIcESaIcEEbRKSbIT_T0_T1_EPKS3_[bool
    std::operator==<char, std::char_traits<char>, std::allocator<char>
    >(std::basic_string<char, std::char_traits<char>, std::allocator<char>
    > const&, char const*)]+0x1f): undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::compare(char const*) const'
    /tmp/cc6hZUsU.o: In function `std::vector<double,
    std::allocator<double>
    >::_M_insert_aux(__gnu_cxx::__normal_iterator<double*,
    std::vector<double, std::allocator<double> > >, double const&)':
    ready.cpp:(.text._ZNSt6vectorIdSaIdEE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPdS1_EERKd[std::vector<double,
    std::allocator<double>
    >::_M_insert_aux(__gnu_cxx::__normal_iterator<double*,
    std::vector<double, std::allocator<double> > >, double
    const&)]+0x25d): undefined reference to `__cxa_begin_catch'
    ready.cpp:(.text._ZNSt6vectorIdSaIdEE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPdS1_EERKd[std::vector<double,
    std::allocator<double>
    >::_M_insert_aux(__gnu_cxx::__normal_iterator<double*,
    std::vector<double, std::allocator<double> > >, double
    const&)]+0x2c2): undefined reference to `__cxa_rethrow'
    ready.cpp:(.text._ZNSt6vectorIdSaIdEE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPdS1_EERKd[std::vector<double,
    std::allocator<double>
    >::_M_insert_aux(__gnu_cxx::__normal_iterator<double*,
    std::vector<double, std::allocator<double> > >, double
    const&)]+0x2cc): undefined reference to `__cxa_end_catch'
    /tmp/cc6hZUsU.o: In function `double* std::vector<double,
    std::allocator<double>
    >::_M_allocate_and_copy<__gnu_cxx::__normal_iterator<double const*,
    std::vector<double, std::allocator<double> > > >(unsigned long,
    __gnu_cxx::__normal_iterator<double const*, std::vector<double,
    std::allocator<double> > >, __gnu_cxx::__normal_iterator<double
    const*, std::vector<double, std::allocator<double> > >)':
    ready.cpp:(.text._ZNSt6vectorIdSaIdEE20_M_allocate_and_copyIN9__gnu_cxx17__normal_iteratorIPKdS1_EEEEPdmT_S9_[double*
    std::vector<double, std::allocator<double>
    >::_M_allocate_and_copy<__gnu_cxx::__normal_iterator<double const*,
    std::vector<double, std::allocator<double> > > >(unsigned long,
    __gnu_cxx::__normal_iterator<double const*, std::vector<double,
    std::allocator<double> > >, __gnu_cxx::__normal_iterator<double
    const*, std::vector<double, std::allocator<double> > >)]+0x69):
    undefined reference to `__cxa_begin_catch'
    ready.cpp:(.text._ZNSt6vectorIdSaIdEE20_M_allocate_and_copyIN9__gnu_cxx17__normal_iteratorIPKdS1_EEEEPdmT_S9_[double*
    std::vector<double, std::allocator<double>
    >::_M_allocate_and_copy<__gnu_cxx::__normal_iterator<double const*,
    std::vector<double, std::allocator<double> > > >(unsigned long,
    __gnu_cxx::__normal_iterator<double const*, std::vector<double,
    std::allocator<double> > >, __gnu_cxx::__normal_iterator<double
    const*, std::vector<double, std::allocator<double> > >)]+0x85):
    undefined reference to `__cxa_rethrow'
    ready.cpp:(.text._ZNSt6vectorIdSaIdEE20_M_allocate_and_copyIN9__gnu_cxx17__normal_iteratorIPKdS1_EEEEPdmT_S9_[double*
    std::vector<double, std::allocator<double>
    >::_M_allocate_and_copy<__gnu_cxx::__normal_iterator<double const*,
    std::vector<double, std::allocator<double> > > >(unsigned long,
    __gnu_cxx::__normal_iterator<double const*, std::vector<double,
    std::allocator<double> > >, __gnu_cxx::__normal_iterator<double
    const*, std::vector<double, std::allocator<double> > >)]+0x8f):
    undefined reference to `__cxa_end_catch'
    /tmp/cc6hZUsU.o: In function `std::vector<double,
    std::allocator<double> >::_M_check_len(unsigned long, char const*)
    const':
    ready.cpp:(.text._ZNKSt6vectorIdSaIdEE12_M_check_lenEmPKc[std::vector<double,
    std::allocator<double> >::_M_check_len(unsigned long, char const*)
    const]+0x4c): undefined reference to `std::__throw_length_error(char
    const*)'
    /tmp/cc6hZUsU.o: In function
    `__gnu_cxx::new_allocator<double>::deallocate(double*, unsigned
    long)':
    ready.cpp:(.text._ZN9__gnu_cxx13new_allocatorIdE10deallocateEPdm[__gnu_cxx::new_allocator<double>::deallocate(double*,
    unsigned long)]+0x1c): undefined reference to `operator delete(void*)'
    /tmp/cc6hZUsU.o: In function
    `__gnu_cxx::new_allocator<std::complex<double> >::allocate(unsigned
    long, void const*)':
    ready.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt7complexIdEE8allocateEmPKv[__gnu_cxx::new_allocator<std::complex<double>
    >::allocate(unsigned long, void const*)]+0x35): undefined reference to
    `std::__throw_bad_alloc()'
    ready.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt7complexIdEE8allocateEmPKv[__gnu_cxx::new_allocator<std::complex<double>
    >::allocate(unsigned long, void const*)]+0x45): undefined reference to
    `operator new(unsigned long)'
    /tmp/cc6hZUsU.o: In function
    `__gnu_cxx::new_allocator<std::complex<double>
    >::deallocate(std::complex<double>*, unsigned long)':
    ready.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt7complexIdEE10deallocateEPS2_m[__gnu_cxx::new_allocator<std::complex<double>
    >::deallocate(std::complex<double>*, unsigned long)]+0x1c): undefined
    reference to `operator delete(void*)'
    /tmp/cc6hZUsU.o: In function
    `__gnu_cxx::new_allocator<double>::allocate(unsigned long, void
    const*)':
    ready.cpp:(.text._ZN9__gnu_cxx13new_allocatorIdE8allocateEmPKv[__gnu_cxx::new_allocator<double>::allocate(unsigned
    long, void const*)]+0x35): undefined reference to
    `std::__throw_bad_alloc()'
    ready.cpp:(.text._ZN9__gnu_cxx13new_allocatorIdE8allocateEmPKv[__gnu_cxx::new_allocator<double>::allocate(unsigned
    long, void const*)]+0x45): undefined reference to `operator
    new(unsigned long)'
    /tmp/cc6hZUsU.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
    /tmp/cc6hZUsU.o:(.eh_frame+0x12b): undefined reference to `__gxx_personality_v0'
    collect2: ld returned 1 exit status
    

    Woran kann das liegen? Habe noch nie etwas für Linux programmiert...



  • Benutz den Befehl g++ damit alle benötigten Bibliotheken mit gelinkt werden



  • Dir ist aber schon klar das du unter Linux das <windows.h> nicht hast, oder?

    Wenn du irgendwelche Sachen von dort brauchst, musst du halt schauen das es die gleichen/ähnlichen Sachen unter Linux gibst und dann im Programm beide Sachen einbauen, und je nachdem für welches System du kompilierst muss halt eine Compileranweisung an der entsprechenden Stelle drin stehen.


Anmelden zum Antworten