• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

"keine Berechtigung" bei selbs compilierten Progra

Hallo,

ich habe ein Problem, das hier zwar schon einmal aufgetaucht ist, aber in anderem Zusammenhang und vor allem nicht mit einer Lösung für mich.
Deswegen hier nochmal:

Ein C++ Programm wird von mir mit cpp compiliert. Es kommen keine Fehlermeldungen und auch die Ausgabedatei wird nach meinen Wünschen erstellt.
Wenn ich nun das Programm mit ./<Programm> aufrufe,
steht in der Kommandozeile nur:

Code:
bash: ./aaai: Keine Berechtigung
wobei aaai hier mein sehr sinniger Programmname ist.

Das merkwürdige an dieser Sache ist, daß gestern alles funktioniert hat (allerdings mit anderem Quellcode). Das, was ich gestern compiliert habe, läßt sich heute ganz normal starten. Wenn ich das nun aber nochmal neu compiliere, kommt die gleiche Fehlermeldung.

Was ich nun schon ausprobiert habe, ist die Berechtigungen zu ändern.
Mit chmod +x kann ich das Programm nun starten (auch das war bis gestern noch nicht nötig).
Allerdings sehe ich dann das:

Code:
./testprog: line 56: enum: command not found
./testprog: line 58: __LC_CTYPE: command not found
./testprog: line 59: __LC_NUMERIC: command not found
./testprog: line 60: __LC_TIME: command not found
./testprog: line 61: __LC_COLLATE: command not found
./testprog: line 62: __LC_MONETARY: command not found
./testprog: line 63: __LC_MESSAGES: command not found
./testprog: line 64: __LC_ALL: command not found
./testprog: line 65: __LC_PAPER: command not found
./testprog: line 66: __LC_NAME: command not found
./testprog: line 67: __LC_ADDRESS: command not found
./testprog: line 68: __LC_TELEPHONE: command not found
./testprog: line 69: __LC_MEASUREMENT: command not found
./testprog: line 70: __LC_IDENTIFICATION: command not found
./testprog: line 74: extern: command not found
./testprog: line 76: struct: command not found
./testprog: line 80: char: command not found
./testprog: line 81: char: command not found
./testprog: line 87: char: command not found
./testprog: line 93: char: command not found
./testprog: line 94: char: command not found
./testprog: line 95: char: command not found
./testprog: line 96: char: command not found
./testprog: line 97: char: command not found
./testprog: line 98: char: command not found
./testprog: line 99: char: command not found
./testprog: line 100: char: command not found
./testprog: line 101: char: command not found
./testprog: line 103: char: command not found
./testprog: line 105: char: command not found
./testprog: line 107: char: command not found
./testprog: line 109: char: command not found
./testprog: line 116: char: command not found
./testprog: line 117: char: command not found
./testprog: line 120: char: command not found
./testprog: line 122: char: command not found
./testprog: line 124: char: command not found
./testprog: line 126: char: command not found
./testprog: line 133: char: command not found
./testprog: line 134: char: command not found
./testprog: line 142: syntax error near unexpected token `('
./testprog: line 142: `extern char *setlocale (int __category, const char *__locale) ;'

Und der Programmcode dafür ist:
Code:
#include<iostream>

int main(){


return 0;
}

Es sollte also eigentlich gar nichts kommen.

Für jeden Tip bin ich dankbar.
 
Moin McMinty,

erstens die Frage: Mittels welchem Befehl kompilierst Du deine Programme? (Am Besten mal mit der bash-history zurück holen, evtl. ist da schon was 'merkwürdig' gelaufen)
zweitens wunder ich mich das Du aaai ausführen willst und Fehlermeldungen eines Programmes testprog bekommst. Aber da nehme ich an das Du uns nur nicht verraten hast das Du nun ein anderes Programm gewählt hast.

Wenn dein Programm tatsächlich keinen anderen Code als den Zitierten enthält, würde ich jetzt spontan drauf tippen das beim includieren von iostream irgendwas fürchterlich schief läuft. Ohne dir jetzt Angst machen zu wollen: Check mal das Filesystem deiner Festplatte.
 
Vielen Dank erstmal!

Also compilieren mache ich über
Code:
cpp quelldatei.cc -o programmname

Ich habe es wirklich nur mit dem oben geposteten Quellcode gemacht.

Die unterschiedlichen Dateinamen stammen daher, daß ich da natürlich viel ausprobiert habe und dann öfter andere Dateinamen gewählt habe, warum, weiß ich aber auch nicht ;-)

Wenn ich meinen Code nun auf
Code:
int main(){


return 0;
}

reduziere, habe ich als Fehlermeldung beim Aufruf des Programms (nicht beim compilieren):

Code:
./testprog: line 7: syntax error near unexpected token `('
./testprog: line 7: `int main(){'


Aber jetzt, wo ich darüber nachdenke, fällt mir ein, daß ich gestern noch ein SuSE- Update für den Kernel installiert habe. Wahrscheinlich liegt dort irgendwo der Hund begraben.
 
McMinty, Du kompilierst das Programm nicht, sondern Du präprozessierst es.

Das hier
Code:
cpp quelldatei.cc -o programmname
ist falsch, weil cpp kein Compiler, sondern ein Präprozessor ist.

Richtig wäre
Code:
c++ quelldatei.cc -o programmname
Und mit dem Kernel-Update bist Du auf der völlig falschen Fährte. Das ist kein Kernel-Problem, sondern ein Bedienungsfehler.
 
Auch wenn ich nicht weiß, warum es gestern (und vorgestern und die Jahre davor) funktioniert hat....

Vielen Dank

Problem gelöst




Und ich werde mich jetzt voller Scham in meine Ecke zurückziehen.
 
Oben