Koozali.org: home of the SME Server

Problem executing binary file

Richter

Problem executing binary file
« on: August 03, 2002, 01:47:42 PM »
Could someone here fill me up with a problem I'm having?

I wanted to compile packages on my SME Server so I've downloaded following RPMs like it was specified in the FAQ

cpp
glibc-devel
glib-devel
make
libstdc++-devel
gcc
gcc-c++
kernel-headers

I had no problem installing those packages and in fact I had no problem compiling a program after installing them


So what seems the problem?
Well it sound damn but I am having problem executing the binary file that was written after compiling the package


for example I can compile a source code

helloworld.cpp with

g++ helloworld.cpp -o helloworld


but it does not execute the program when I type "helloworld" at the console


So.... whatta hell?
I appreciate any input, what seems the problem and how I go fixing it?

brian read

Re: Problem executing binary file
« Reply #1 on: August 03, 2002, 05:01:56 PM »
you must make sure that the executible file is set executible (your compiler may have done this for you)

chmod +x helloworld

and also Linux(unix) does not look in the current directory for executibles when you try to executre them on the command line, try

./helloworld

Cheers

Brian

Richter

Re: Re: Problem executing binary file
« Reply #2 on: August 03, 2002, 06:05:05 PM »
thank you very much Brian,

You are right, it was the problem with the path.
I assumed linux would run executables in current directory but I guess I was dead wrong


once again thanks heaps

Cheers

Luke Drumm

Re: Re: Problem executing binary file
« Reply #3 on: August 06, 2002, 02:40:47 AM »
Note: This is feature of being logged in as root.

'Normal' users of linux tend to have the path set up so that it looks in the current directory but it's deemed wiser for root not to work this way.

It provides extra protection against malicous users creating trojan programs for root to accidently run.

Regards,
Luke

brian read

Re: Re: Problem executing binary file
« Reply #4 on: August 06, 2002, 10:05:15 AM »
Thanks for that, didn't know...

Must try logging in as something other that root occasionally.

Cheers

Brian

Richter

Re: Re: Problem executing binary file
« Reply #5 on: August 06, 2002, 07:22:56 PM »
Yes same here,

I know it's bad habit and it is never advised to login as root all the time

but I tend to be lazy to switch back to normal user even when I'm not doing administrative task

Anyway, it's good to know these kinda stuff,
thanks Luke