DebianThis forum is for the discussion of Debian Linux.
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.
i just installed knopix 3.3 on my hard drive. and i try to write a simple c++ program in the Konsole by using vi editor. i named it hello.cpp, but when i compile it, and type a.out, it said bash: a.out: command not found!!
//this is the output what's on my screen:
knoppix@sharp:~/documents$ g++ hello.cpp
knoppix@sharp:~/documents$ a.out
bash: a.out: command not found
knoppix@sharp:~/documents$ g++ -o hello hello.cpp
knoppix@sharp:~/documents$ hello
bash: hello: command not found
knoppix@sharp:~/documents$
i try both g++ and g++ -o option and it didn't work....
it work before if i boot from the Knoppix cd.....but how come it doesn't work after i install it?
i'm really new at this....this is really my first time using linux.....so please forgive me if i ask some stupid questions.
I'm sorry but I don't seem to be able to get it work. I have the current directory now in the $PATH variable, and a working program a.out, but I still have the following issue with gdb
GNU gdb Red Hat Linux (6.0post-0.20040223.17rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"..."/home/jonh/dynamicrewire/numerics/a.out": not in executable format: File format not recognized
Hmm - that should work. I don't know why the format of a.out isn't recognized. You might want to try recompiling the file in case it's an error, or try it on another program (like /bin/ls). Make sure after you start the gdb program with the program name as the argument, you type in "run" at the gdb command prompt to see your program actually run!
Below, the teal is what you should be typing, the rest is roughly what you should see:
~$ gdb a.out
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-linux".
(gdb) run
======
As a side note, good UNIX's NEVER, EVER, EVER have the current folder as part of the path, this isn't just a slip on knoppix's part. This is for both historical reasons as well as security reasons - imagine if someone made their own "ls" program that did (insert something bad here), and root accidentally ran it when going to that user's profile directory and typing "ls" (to check the folder's contents - the "./" convention is to make it clear that you are intentionally running a program in THIS directory, and not one from /bin, or /usr/bin, or the like. It's not necessary when running gdb, because you're just sending it the file "a.out" as an argument, so it makes sense to check the current directory, in much the same way that "kword file.doc" would check the current directory for "file.doc".
So, I would leave the current path (which is denoted simply by a dot ".") out of the deal, and try to get used to the idea of "./programname"
The file a.out does work if I just run it from the shell. If I try to gdb /bin/ls I get:
bash-2.05b$ gdb /bin/ls
GNU gdb Red Hat Linux (6.0post-0.20040223.17rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"..."/bin/ls": not in executable format: File format not recognized
and for example if I try to run a.out from gdb then because the format is not recognized I get the message:
(gdb) run
Starting program:
No executable file specified.
Use the "file" or "exec-file" command.
Well, I'm pretty well stumped. I would try posting in some redhat forums, to see if maybe it's a bug with the gdb in your version of redhat. Also, try getting all the latest updates for gdb and all related packages, if any are available!
I've seen you posted on gdb lists at gnu.
If you'll find the problem please let us (me) know. I've seen that someone said to you there that you should compile with the -g option. That is not quite correct for the error you are seeing.
I thought that it would be a problem with the a.out file but if you say that you get errors with /bin/ls than that's not good. You definetly should point the problems with /bin/ls to them.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.