andes135
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Hallo zusammen, ich versuche gerade, Eclipse unter Ubuntu 14.04 LTS einzurichten. Installiert habe ich es schon mal. Mein Hello World Programm scheint auch gebuilded zu werden. Doch gleich beim ersten #include mit stdio.h kommt ein Hinweis und zwar Unresolved inclusion: <stdio.h> Im Netz habe ich was gelesen, dass spezielle Pfade erst angepasst werden müßen. Kennt sich da jemand aus ?
|
andes135
(Themenstarter)
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Hallo nochmal, wieso bringt mir bei diesem kleinen Programm Eclipse nach dem Built 23 Fehler ? #include <stdio.h>
main()
{
printf("ff");
}
Anbei die Fehlermeldungen: Description Resource Path Location Type
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 21 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13 qqqaa C/C++ Problem
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2 qqqaa C/C++ Problem
make: *** [qqqaa] Fehler 1 qqqaa C/C++ Problem
Nicht definierter Verweis auf `main' qqqaa C/C++ Problem
|
andes135
(Themenstarter)
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Hat niemand eine Idee woran es liegen könnte
|
greenmoon
Anmeldungsdatum: 10. März 2010
Beiträge: 269
|
Fangen wir doch erstmal grob an. Möchtest du C oder C++ Code schreiben? (zumindest mir ist das noch nicht klar). Im falle von c++ include mal 'cstdio' statt stdio.h. Ansonsten werden die includes bei Verwendung von den '< >' überlicherweise in '/usr/include' gesucht. Kannst ja mal nachgucken was du da so findest. Muss es nicht außerdem 'int main()' heißen und 'return 0;'? Oder ist das optional? Edit: Ich hab das mit dem main angesprochen weil sich bei dir make wegen einen "Nicht definierter Verweis auf main'" beschwert. Außerdem wäre es vllt gut zu wissen was make eigentlich ausführt, benutzt du ein makefile? verlässt du dich auf die automatischen build regeln von make? Fragen über Fragen
|
andes135
(Themenstarter)
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Danke greenmoon, ich möchte in c programmieren. das mit int main habe ich auch schon versucht, leider ohne Erfolg. Das Einzigste was auf anhieb immer klappt ist, wenn ich ein neues Projekt mit dem vorgefertigten HelloWorld Programm starte, dann diese Zeilen durch die meinige Ersetze und siehe da, es geht. Scheint wohl doch ein Konfigurationsproblem von Eclipse zu sein. Ich habe aber leider so auf die Schnelle keine Unteschiede feststellen können in den Properties......
|
andes135
(Themenstarter)
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Ich erkläre mal, wie ich vorgehe, wenn ich ein neues Projekt anlege: 1. New –> C Projekt
2. New –> source folder
3. New –> source file –> main.c Dann kommt der Code rein und der erste Built.
|
andes135
(Themenstarter)
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Hier die Fehlermeldung aus der Console: 19:04:34 **** Incremental Build of configuration Debug for project g ****
make all
Building file: ../main.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.c"
Finished building: ../main.c
Building target: g
Invoking: GCC C Linker
gcc -o "g" ./main.o
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 21
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In Funktion `_start':
(.text+0x20): Nicht definierter Verweis auf `main'
collect2: error: ld returned 1 exit status
make: *** [g] Fehler 1
|
greenmoon
Anmeldungsdatum: 10. März 2010
Beiträge: 269
|
So, jetzt lassen wir eclipse erstmal außen vor. Versuchen wir einfach mal das, was eclipse automatisch machen will per Hand nim terminal nachzustellen, d.h.
gcc -Wall -c test.c
gcc -Wall -o out test.o
(was in dem Fall "unnötig" kompliziert ist, ein einfaches 'gcc -Wall test.c' hätte auch gereicht). Wenn das problemlos funktioniert, was es sollte, wissen wir wenigstens schonmal dass es wirklich an eclipse liegt. Vielleicht sollte man sich dann mal überlegen, ob diese ganzen Parameter '-fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" ' wirklich nötig sind, spontan hab ich keine Ahnung was die machen. (wobei auch das so bei mir funktioniert)
|
andes135
(Themenstarter)
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Hallo greenmoon, der erste Befehl wird problemlos abgearbeitet, beim 2. kommt die Fehlermeldung gcc: fatal error: no input files
compilation terminated.
|
greenmoon
Anmeldungsdatum: 10. März 2010
Beiträge: 269
|
Das kann nicht sein. Im zweitem Befehl ist 'test.o' das input file, welche der erste Befehl aus der 'test.c' generiert. Von daher hast du irgendwas falsch gemacht. Es ist übrigens immer hilfreich die Befehle inklusive Fehlermeldung vollständig zu posten um Fehler zu finden. Wenn das jetzt funktioniert probier mal das aus, was eclipse automatisch versucht, soll heißen führe die Befehle
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "main.c"
gcc -o "g" ./main.o
aus. Achtung die datei heißt hier jetzt wieder 'main.c'
|
andes135
(Themenstarter)
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Also nochmal, der Inhalt von iii/src sieht so aus:
iii iii.c iii.o Mache ich ein:
sudo gcc -Wall -o out iii.o
gcc: error: iii.o: Datei oder Verzeichnis nicht gefunden
gcc: fatal error: no input files
compilation terminated. erscheint die obestehende Fehlermeldung. Was mache ich falsch ???
|
greenmoon
Anmeldungsdatum: 10. März 2010
Beiträge: 269
|
Ehrlich gesagt keine Ahnung. Wenn die Datei so heißt und trotzdem nicht gefunden wird befindet man sich überlichweise im falschen Ordner, allerdings hätte dann auch der erste Befehl nicht funktioniert. Generell ist das sudo übrigens quatsch an der Stelle, bitte nur verwenden wenn wirklich nötig. Zur Sicherheit navigiere einfach mal in den Ordner) bei dir also iii/src), führe ein 'ls -l' aus, beide gcc Aufrufe und poste das ganze bitte gemeinsam in einem Codeblock. Irgendwas kann da nicht stimmen
|
andes135
(Themenstarter)
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Ich habe es auch mal ohne sudo versucht, das gleiche Ergebnis. Die Ausgabe von ls -l ergibt: insgesamt 52
-rwxr-xr-x 1 root root 8509 Feb 9 20:52 iii
-rw-rw-r-- 1 arubuntu arubuntu 445 Feb 7 20:03 iii.c
-rwxr-xr-x 1 root root 8509 Feb 9 20:52 iii.o
|
andes135
(Themenstarter)
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Ah nochwas, wwenn ich jetzt ohne sudo mache kommt folgendes ( ich habe in ein anderes Programm gewechselt, nicht wundern wenn hier wieder main.c steht ):
gcc -Wall -o out main.o
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 21
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In Funktion `_start':
(.text+0x20): Nicht definierter Verweis auf `main'
collect2: error: ld returned 1 exit status
Ich verstehe einfach nicht, warum das vorgefertigte HelloWorld Programm sich kompilieren läßt, selbst wenn ich es durch die eigenen Codezeilen ersetze, also mein eigenes Programm nehme, aber ein neues, leeres Projekt sich einfach nicht kompilieren läßt.....
|
andes135
(Themenstarter)
Anmeldungsdatum: 18. September 2011
Beiträge: 584
|
Ich glaube, ich habe den Fehler gefunden. Einfach nur doof. Muß man immer auf speichern klicken, bevor man das Programm kompiliert ? Denn dann scheint es zu gehen.......
|