Linux - General This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
10-06-2002, 03:35 AM
|
#1
|
Member
Registered: Aug 2002
Distribution: Slackware 8.1
Posts: 750
Rep:
|
Yes you are
To compile win10.cpp - gcc -o test win10.cpp
Then chmod 777 win10
To execute write : ./win10
I think you got it
|
|
|
10-06-2002, 03:37 AM
|
#2
|
LQ Newbie
Registered: Oct 2002
Posts: 2
Rep:
|
problem running progs compiled with g++
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.
Any ideas what I'm doing wrong?
|
|
|
10-06-2002, 06:45 AM
|
#3
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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.
|
|
|
10-06-2002, 06:56 AM
|
#4
|
Member
Registered: Aug 2002
Distribution: Slackware 8.1
Posts: 750
Original Poster
Rep:
|
Oh I am very sorry............
Ofcourse it should be ./test
thnx acid!!!
|
|
|
10-06-2002, 07:20 AM
|
#5
|
Member
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538
Rep:
|
do this (i don't know if this is all clear yet or not?)
g++ -o win10 win10.cpp
./win10
It should work o.k. (assuming that your code is correct ;-)
by the way... watch out with gcc 3.1.... There is a (at least one) bug in it with using the header <string.h> and the getline function from that
|
|
|
10-06-2002, 09:23 AM
|
#6
|
Member
Registered: Mar 2002
Location: Debian Galaxy
Distribution: Debian
Posts: 711
Rep:
|
"assuming that your code is correct" and if it isn't and you got it compiled, I'd like to ask how. ;-)
Or you mean logic errors.
|
|
|
10-06-2002, 11:52 AM
|
#7
|
Member
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538
Rep:
|
Can't you make "logic errors" and still get it to compile? It just seems to me (newbie) that the two terms mean the same thing.
what IS the difference?
|
|
|
10-06-2002, 11:54 AM
|
#8
|
Member
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538
Rep:
|
p.s. do you all see nautilus as the first message here?
|
|
|
10-06-2002, 12:00 PM
|
#9
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
yes, it's been reported to jeremy.
a logic error is going to be something like
var = 3 * 4 * bignumber * 0;
or somethign equally stupid.
|
|
|
10-06-2002, 01:34 PM
|
#10
|
Member
Registered: Mar 2002
Location: Debian Galaxy
Distribution: Debian
Posts: 711
Rep:
|
Thanks.
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!
|
|
|
10-06-2002, 03:01 PM
|
#11
|
LQ Newbie
Registered: Oct 2002
Posts: 2
Rep:
|
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?
|
|
|
10-06-2002, 03:16 PM
|
#12
|
Member
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538
Rep:
|
"./" 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
"echo $PATH"
|
|
|
All times are GMT -5. The time now is 05:46 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|