Can't run compiler c programs in linux mint

Discussion in 'C' started by duckdace, Oct 9, 2010.

  1. duckdace

    duckdace New Member

    Joined:
    Oct 9, 2010
    Messages:
    9
    Likes Received:
    1
    Trophy Points:
    0
    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?
     
  2. zaster

    zaster New Member

    Joined:
    Oct 9, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Hi
    Try following
    $ ./filename
     
  3. duckdace

    duckdace New Member

    Joined:
    Oct 9, 2010
    Messages:
    9
    Likes Received:
    1
    Trophy Points:
    0
    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?
     
  4. zaster

    zaster New Member

    Joined:
    Oct 9, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    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 ./
     
  5. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice