[gelöst] compilerfehler (ka was das heißt)



  • [gelöst]
    es war meine eigene dummheit:
    g++ main.cpp -o ctl
    [/gelöst]

    Hi,
    normalerweise komme ich ja mit dem Compiler (g++) zurecht, nur dieses mal spuckt er mir nichts brauchbares aus
    die Fehler erschienen erst, als ich die Länge eines Strings aus einem Array bestimmen wollte:

    const int LEN1 = 16;
    string highlight1[LEN1] = {"auto ","char ","const ","double ","extern ","float ","int ","long ","register ","short ","signed ","static ","string ","unsigned ","void ","volatile "};
    int len = highlight1[i].length();
    

    hier die fehler:

    bla@desktop:/media/7A50-5816/projects/c++/code_to_latex/neu$ g++ main.cpp ctl 
    ctl: In function `_start':
    (.text+0x0): multiple definition of `_start'
    /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crt1.o:(.text+0x0): first defined here
    ctl: In function `_fini':
    (.fini+0x0): multiple definition of `_fini'
    /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crti.o:(.fini+0x0): first defined here
    ctl:(.rodata+0x0): multiple definition of `_IO_stdin_used'
    /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crt1.o:(.rodata.cst4+0x0): first defined here
    ctl: In function `itoc(int)':
    (.text+0xe4): multiple definition of `itoc(int)'
    /tmp/ccwfHvcv.o:main.cpp:(.text+0x0): first defined here
    ctl: In function `__data_start':
    (.data+0x0): multiple definition of `__data_start'
    /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crt1.o:(.data+0x0): first defined here
    ctl: In function `__data_start':
    (.data+0x8): multiple definition of `__dso_handle'
    /usr/lib/gcc/x86_64-linux-gnu/4.4.3/crtbegin.o:(.data+0x0): first defined here
    ctl: In function `inttocolor(int)':
    (.text+0x14b): multiple definition of `inttocolor(int)'
    /tmp/ccwfHvcv.o:main.cpp:(.text+0x67): first defined here
    ctl: In function `main':
    (.text+0x3c1): multiple definition of `main'
    /tmp/ccwfHvcv.o:main.cpp:(.text+0x2dd): first defined here
    ctl: In function `_init':
    (.init+0x0): multiple definition of `_init'
    /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crti.o:(.init+0x0): first defined here
    /usr/lib/gcc/x86_64-linux-gnu/4.4.3/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__'
    ctl:(.dtors+0x8): first defined here
    /usr/bin/ld: error in ctl(.eh_frame); no .eh_frame_hdr table will be created.
    collect2: ld returned 1 exit status
    

    Ich kann damit wirklich gar nichts anfangen!!!
    Bin für jede Hilfe dankbar!



  • Was soll denn das ctl im Compileraufruf bewirken? Soll das der Name des erstellten Programms sein? Dann muss da -o davor.



  • mist, war zu langsam, aber danke! 😉



  • Pack das [gelöst] lieber in den Threadtitel, dann weiß man schon Bescheid, bevor man hier nachsieht.


Anmelden zum Antworten