Home > Net >  Can't find compiled executable in Linux terminal
Can't find compiled executable in Linux terminal

Time:09-13

I've created a hello world program in c and tried to compile it in c like this.

[aleksf@ic-ifi-rh8-026 cpp]$ g   testing.cpp -o testing

I know that the testing file was created because

[aleksf@ic-ifi-rh8-026 cpp]$ ls -A
testing  testing.cpp

But when I try to execute the file it can't find it.

[aleksf@ic-ifi-rh8-026 cpp]$ .\testing
bash: .testing: command not found...

I don't understand whats gone wrong as this is what I've been told works.

CodePudding user response:

Linux does not use \ it uses / for directory paths. Try ./testing.

CodePudding user response:

Like Russel have pointed out, you need to use forward slash: ./testing

The file you're trying to run also needs to have the executable mode bit set. You can fix that by running: chmod x testing

  • Related