0

I've a big problem running programs in programming languages which need ./ to be executed (C, C++, Pascal and others) and I've really tried everything to solve it, including changing permissions on the files. This problem arose seven months ago.

I can't really explain why and how it appeared out of the blue: the day before I could run the programs, the next day no. I've no problems running programs in languages which don't need ./. I've asked some friends of mine who study computer science but neither them have found the problem.

Anwar
  • 76,649
GIULIO
  • 1
  • 3
    You will need to give us SPECIFIC examples if you want more focused help. When changing permissions on files fails to "stick", the cause is usually that the filesystem either doesn't support them (e.g. you're trying to execute files on a FAT or NTFS device) or has been mounted with the noexec option. – steeldriver Aug 26 '16 at 14:52
  • The ./ is your saying to the terminal that, run the program in current directory with name. If you don't like it, use one from hundreds of IDE available for Ubuntu. You can use geany for example – Anwar Aug 26 '16 at 15:41
  • I've always used Geany to compile. I really don't understand why it stopped working properly some months ago. It never happened before, this is the point, so I think I did something, unwittingly, that doesn't allow me to run the programs anymore. Apart from this, do you know another ways to run C, C++ programs without using ./? – GIULIO Aug 27 '16 at 18:13

1 Answers1

1

It's not a permissions issue, but a path issue.

The ./ is required because it specifies the path of the file you intend to execute (or edit, touch, whatever).

If you don't specify a path (for instance, running a program like vim), the shell will look at your $PATH variable (which is a list of folders) and look in each one until it either finds a file that matches or exhausts the list without finding one.

Some users like to add . to their $PATH so that they can always interact with files in whatever directory they're in. It may be the case that . used to be in your $PATH and was somehow removed.

There's more information and a complete answer regarding adding a directory (including .) to your $PATH at How to add a directory to the PATH?

Nick Barth
  • 11
  • 2
  • No, I don't think my problem could be solved in this way. As I said, Java, Python, Perl, every language which don't need ./ to run, are not a problem. I use geany as IDE, but this doesn't solve the problem. I've always specified the path, but nothing. I tried using chmod command in all the ways possible, but nothing too. – GIULIO Sep 06 '16 at 14:31