Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My computer is having a problem running programs I compiled using g++. For example, I compiled a program called win10.cpp. It compiles fine, and the binary is called win10. When I type win10, the computer says:
bash: win10: command not found
I even compiled my program on another computer (via ssh). It ran fine, so I downloaded the compiled program to my computer. When I tried to run it on my computer, I got the same old error message.
you shouldn't normally need to use the chmod command. and of course in your example, you called the output file "test" so ./win10 will obviously not exist. and also gcc is primarily a c compiler, not c++, but that doesn't matter really.
A logic error is not a problem to the computer, like acid pointed out. But it IS a problem to the end user. For example, you want to calculate the average salary, instead you put in a code that does hourly rate. You get it compiled.
In short, a logic error is an unexpected result.
Design-time errors can't get past compilers.
And there are run-time errors. Like legal code, but it produces a number bigger than your variable can hold. Boom!
OK. Chmod didn't do anything because win10 was already -rwxrwxrwx. So I
tried ./win10 and it worked!!!! I am so happy. Thanks to everyone for your
help.
underdog
Oh, by the way. Does anyone know why this works? Is it possible to change
some settings so that I don't have to type ./ every time?
"./" just means to stay in the current directory when looking for the executable. if you are not in the directory, and it is in, say... /home/adam/programs/ you would type"/home/adam/programs/win10" basically, a "." means current directory, and ".." means one directory up on the filesystem (hence cd ..)
If you don't want to do this, you can put the program somewhere in your $PATH. to see which directories these are, do
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.