Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Can't run compiler c programs in linux mint (http://www.go4expert.com/forums/run-compiler-c-programs-linux-mint-t23530/)

duckdace 9Oct2010 14:04

Can't run compiler c programs in linux mint
 
Hi.

I guess this is more a linux-question than a programming question, but i put it here because other programmers will propably give the best help on this one.

I'm having troubles running a c program I made after compiling.

What happens is this:

$ gcc filename.c -o filename
$ filename
filename: command not found

I guess there's some sort of package i haven't installed, but I can't figure out which. Can anyone help me?

zaster 9Oct2010 17:06

Re: Can't run compiler c programs in linux mint
 
Hi
Try following
$ ./filename

duckdace 9Oct2010 17:12

Re: Can't run compiler c programs in linux mint
 
Ah, thanks. I recently installed Linux Mint, and I've earlier worked on computers with Red Hat installed, where I didn't need the ./ if I were in the correct folder. Any idea how to that works?

zaster 9Oct2010 17:18

Re: Can't run compiler c programs in linux mint
 
I haven't used mint, though I've been using Ubuntu. I guess you have to explicitly tell the shell that you want to look for the executable inside current directory. You could edit PATH variable to include . (current directory). Then you won't need ./

xpi0t0s 10Oct2010 21:49

Re: Can't run compiler c programs in linux mint
 
Unlike on Windows, Unix doesn't include the current directory. So if you want it to be able to find stuff in the current directory, you have to include . in the path.


All times are GMT +5.5. The time now is 20:32.