PDA

View Full Version : Konsole output goes where??



DougE
07-07-2004, 01:05 AM
I have been working all day to run a simple "Hello, World\n" program with g++. First of all: why are there so many different windows? i.e. shell, Linux console, root console, screen session -- they all appear the same to me at this point. Secondly: I will be damned if I can figure out where std::cout << "Hello, World\n"; goes. What little knowledge I have of C++ has been gained in an IDE, so I am new to Linux, C++, and Konsole :shock: Would someone please help me get started with Konsole? Thanks.

DougE
07-07-2004, 03:17 PM
The program has compiled fine to the same directory as the souce .cpp. In DOS you type the name of the directory where the code compiled, and it runs the program. This does not seem to be the case with Konsole. The code has compiled, but I can't get it to run.

UnderScore
07-07-2004, 04:42 PM
It seems as though you may have complied a executable but have not changed the permissions of the file to BE executable. In linux & unix, a file needs to be allowed to run before it can be run. This would be the same as me handing you a memo of tasks to complete and you would be unable to performs those tasks until I gave you permission.
At the command line you can change the file permissions uising the chmod command.
chmod 700 somefilename

I have found a guide to file permissions here http://www.linuxlookup.com/html/guides/chmod-chown.html . Please note in the guide where they geive us both good and bad examples of file permissions. I hope this helps you.
James

user unknown
07-08-2004, 11:40 PM
In DOS you type the name of the directory where the code compiled, and it runs the program.
That's only true in the seldom case, when the name of the directory matches the name of the binary executable.

If you compile your program like this:

g++ foo.cc -o foo

you start the program with
./foo, because normally the current directory isn't in your PATH.
You may modify your .bashrc to change this

export PATH=.:$PATH

I never had to make my compiled files executable with 'chmod' - the linker does it automatically.

And the output goes depending on the terminal, where it was started.
If you start it on tty4, the output is on tty4, if you start it in a xconsole, the output is in the xconsole...