Can't run compiler c programs in linux mint

duckdace's Avatar, Join Date: Oct 2010
Light Poster
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?
0
zaster's Avatar, Join Date: Oct 2010
Light Poster
Hi
Try following
$ ./filename
duckdace like this
0
duckdace's Avatar, Join Date: Oct 2010
Light Poster
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?
0
zaster's Avatar, Join Date: Oct 2010
Light Poster
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 ./
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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.