FOK!forum / Digital Corner / Ubuntu eenvoudig programma compileren werkt maar uitvoeren niet
DrTokkiemaandag 25 mei 2020 @ 13:35
Ik probeer onderstaand programma te compileren, opgeslagen in een text bestandje antichrist.c, het compileert wel, maar dan heb ik een probleem.

administratie@ubuntud:~/Desktop$ gcc -o antichrist antichrist.c -I .
administratie@ubuntud:~/Desktop$ antichrist
antichrist: command not found
administratie@ubuntud:~/Desktop$

Zoals je ziet kan het programma antichrist niet worden gevonden.

Dingen die ik heb gedaan:
* Compileren
* Met Nautilus bestandsverkenner kijken of het programma echt in de directory is
* Blijven proberen

Het programma antichrist kan ik wel met Nautilus uitvoeren maar er gebeurt niets nada. :{

Hier is het programma, het is erg klein, heb eerst Hello World gestudeerd en toen werkte het gewoon, maar Hello World vond ik veel eenvoudiger om te begrijpen.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include 
#include 

int main() {
  // Build with gcc
  //                 gcc -o antichrist antichrist.c -I .
  printf("King James Revelation 13:18\nThis program converts BILL GATES III to a number, with the universal language that computers use worldwide.\n");
  
  int antichrist=0;
  
  antichrist+=(int)'B';
  antichrist+=(int)'I';
  antichrist+=(int)'L';
  antichrist+=(int)'L';
  antichrist+=(int)'G';
  antichrist+=(int)'A';
  antichrist+=(int)'T';
  antichrist+=(int)'E';
  antichrist+=(int)'S';
  
  int threescore=atoi("III");
  if( threescore==0 ) {
      printf("Roman number III has the value 3\n");
      antichrist+=3;
  }
  
  printf("The number is: %i\n",antichrist);
  if( antichrist==666 ) {
      printf("Here is wisdom. Let him that hath understanding count the number of the beast: for it is the number of a man; and his number is Six hundred threescore and six.\n");
  }
  
  /* This program outputs the following:
   * 
   * 
   * King James Revelation 13:18
This program converts BILL GATES III to a number, with the universal language that computers use worldwide.
Roman number III has the value 3
The number is: 666
Here is wisdom. Let him that hath understanding count the number of the beast: for it is the number of a man; and his number is Six hundred threescore and six.
  */
  
  return(0);
}

Ik vermoed dat ik iets fout doe, in Nautilus staat het programma op executable, maar zoals ik het in de terminal command line wil uitvoeren is de uitvoer:

1
2
3
4
administratie@ubuntud:~/Desktop$ gcc -o antichrist antichrist.c -I .
administratie@ubuntud:~/Desktop$ antichrist
antichrist: command not found
administratie@ubuntud:~/Desktop$ 
:'( hij zit echt in de huidige directory in de terminal, maar uitvoeren lukt niet.
TargaFloriomaandag 25 mei 2020 @ 13:38
Doe eens een ls -l
1administratie@ubuntud:~/Desktop$ ls -l antichrist
DrTokkiemaandag 25 mei 2020 @ 13:47
quote:
0s.gif Op maandag 25 mei 2020 13:38 schreef TargaFlorio het volgende:
Doe eens een ls -l
[ code verwijderd ]

Dan krijg ik mijn xxhamster video's te zien , dus het zijn er zoveel dat ik dat niet kan posten zonder Fok te overbelasten.
Farenjimaandag 25 mei 2020 @ 13:48
Bij executables aanroepen moet je altijd ook de folder erbijdoen, ook als je iets in de huidige folder (".") wil uitvoeren. Dus:

1./antichrist

zou moeten werken.
DrTokkiemaandag 25 mei 2020 @ 13:49
quote:
0s.gif Op maandag 25 mei 2020 13:48 schreef Farenji het volgende:
Bij executables aanroepen moet je altijd ook de folder erbijdoen, ook als je iets in de huidige folder (".") wil uitvoeren. Dus:
[ code verwijderd ]

zou moeten werken.
-rwxrwxr-x 1 administratie administratie 8392 Mai 25 13:26 antichrist

Begrijp alleen niet waar mijn xxhamster video's vandaan kwamen,
TargaFloriomaandag 25 mei 2020 @ 14:00
quote:
11s.gif Op maandag 25 mei 2020 13:47 schreef DrTokkie het volgende:

[..]

Dan krijg ik mijn xxhamster video's te zien , dus het zijn er zoveel dat ik dat niet kan posten zonder Fok te overbelasten.
Als je ls -l antichrist doet krijg je alleen antichrist te zien (of file not found)
DrTokkiemaandag 25 mei 2020 @ 14:37
quote:
0s.gif Op maandag 25 mei 2020 14:00 schreef TargaFlorio het volgende:

[..]

Als je ls -l antichrist doet krijg je alleen antichrist te zien (of file not found)
Het is gelukt, het blijkt namelijk omdat ik de . op de desktop gebruikte als ik op xxhamster zat de .amilfwithbicktitsbigass.mp4 voorrang hadden als ik de tab toets indrukte. Gebruik de tab toets als ik de . indruk in de Desktop directory dan start namelijk VLC Video Player op. De M komt in het alfabet voor de letter N, dus vandaar dat de .amilfwithbicktitsbigass.mp4 en de andere milf videos steeds maar terug kwamen.

Met de . in de bestandsnaam blijft namelijk de Desktop schoon, maar zag dat met ls -l ze er eigenlijk toch zijn.

1
2
3
4
5
6
7
administratie@ubuntu:~/Desktop$ ./antichrist
King James Revelation 13:18
This program converts BILL GATES III to a number, with the universal language that computers use worldwide.
Roman number III has the value 3
The number is: 666
Here is wisdom. Let him that hath understanding count the number of the beast: for it is the number of a man; and his number is Six hundred threescore and six.
administratie@ubuntu:~/Desktop$ 

Kan volgensmij beter xxhamster video's in een andere map opslaan, was wel zo handig, je zette gewoon een . voor de bestandsnaam en daardoor werkte de tab toets wel maar de letter m komt voor n.
TargaFloriomaandag 25 mei 2020 @ 14:38
^O^
DrTokkiemaandag 25 mei 2020 @ 14:41
quote:
0s.gif Op maandag 25 mei 2020 14:38 schreef TargaFlorio het volgende:
^O^
Dankje, misschien ben ik niet weggelegd om programmeur te worden, Hello World ging nog wel, maar stdio.h includen begreep ik, maar toen moest zelfs nog stdlib.h included worden.

Na een maand programmeren is het toch gelukt, maar ik vind het te moeilijk.
TargaFloriomaandag 25 mei 2020 @ 14:50
quote:
0s.gif Op maandag 25 mei 2020 14:41 schreef DrTokkie het volgende:

[..]

Dankje, misschien ben ik niet weggelegd om programmeur te worden, Hello World ging nog wel, maar stdio.h includen begreep ik, maar toen moest zelfs nog stdlib.h included worden.

Na een maand programmeren is het toch gelukt, maar ik vind het te moeilijk.
In ver verleden wel C en C++ gehad maar daarna nooit iets meegedaan. Momenteel bezig met cursus HTML/CSS en Javascript. Uitleg begrijp ik over het algemeen wel maar om zelf iets te maken van scratch valt niet mee.