Thread: wierd problem with gcc

  1. #1
    Super unModrator
    Join Date
    Dec 2007

    wierd problem with gcc

    I made a simple program which opens a text file and prints "file opened successfully" or "error opening file" depending whether the file was opened or not. I compiled it and copied the executable to /usr/bin so that I could issue commands like open filename.txt without the additional ./ [dot forward slash] before it.

    I later deleted that executable from /usr/bin but now every time I type gcc without anything else, instead of saying "No input files" it says "error opening file". If I try to compile some other program like gcc hello.c -o hello, it doesn't compile anything just says "file opened successfully". What do you think is the problem?

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Um, you renamed your program to "gcc" inside /usr/bin/?

  3. #3
    Super unModrator
    Join Date
    Dec 2007
    No its name was 'cc'

    I did sudo cp /home/abhishek/Desktop/cc /usr/bin

    I should have named it openfile or something like that

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005

    GCC might call "cc". Issuing your command would have overwritten GCC's cc with your own. Then you deleted it, so GCC can no longer open "cc" . . . .

    What could you do about this? You could reinstall GCC. Depending on your system, you might be able to copy a "cc" from a similar installation.

    Though, on my Debian system,
    $ file /usr/bin/cc
    /usr/bin/cc: symbolic link to `/etc/alternatives/cc'
    cc is just a symlink, so you might be able to re-create it.

    On a side note: never touch /usr/bin. You can just create your own directory, say ~/bin, and put that directory in the PATH. It's a much better idea, for reasons that are probably painfully obvious.

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Wierd problem
    By darsatdusk in forum C Programming
    Replies: 7
    Last Post: 11-03-2008, 09:49 AM
  2. Problem with gcc
    By jayee_spicyguy in forum Linux Programming
    Replies: 8
    Last Post: 10-21-2008, 08:12 AM
  3. Wierd Malloc Problem
    By mohankarthik in forum C Programming
    Replies: 11
    Last Post: 09-17-2008, 02:14 PM
  4. Wierd problem
    By Olidivera in forum C++ Programming
    Replies: 17
    Last Post: 05-06-2005, 04:50 AM
  5. problem with gcc or with my brain
    By neo51 in forum C Programming
    Replies: 6
    Last Post: 09-09-2002, 02:07 AM