Thread: a.out remains unchanged

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    17

    a.out remains unchanged

    Hello,

    I am writing a C program on Ubuntu Linux. I compile using the gcc compiler. I was making changes and compiling the program and a.out was reflecting the new changes. After a few hours, I am observing that any changes I make to the program are not getting reflected in my a.out. It seems to show me the same output that I got sometime ago. Even an extra print statement does not show up. Not sure if I need to do some sort of flush here. My program uses arrays and pthread calls.

    Any input on this will be greatly appreciated.

    Thanks

  2. #2
    Beautiful to C Aia's Avatar
    Join Date
    Jun 2007
    Posts
    124
    Deleting that a.out file, or giving it another name to the compiled file will troubleshoot better what the problem is.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    17
    Hello thanks but I have tried both options, without any luck

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Do you experience the same problem with a hello world program?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    17
    yes. for any program I write, I get the same old output of a different program even after attempting to
    1. deleting a.out
    2.renaming the file
    3.rebooting the system.

  6. #6
    Registered User
    Join Date
    Feb 2006
    Posts
    54
    are you deleting it using rm or using the trash?
    Do you have write permission on the file?

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What command did you run at the command line to compile the program? Do you place each program's source code in a separate directory to avoid confusion?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Registered User
    Join Date
    Jan 2008
    Posts
    17
    I am deleting it using the rm command. I make sure there is is not there before re-compiling it. But the new a.out file that gets created still shows the output from a different program I ran earlier.

  9. #9
    Registered User
    Join Date
    Jan 2008
    Posts
    17
    I am compiling a simple 'hello world' the program using the following command

    gcc filename.c

    I made sure I have write permissions on a.out and the directory. I have each source in a separate directory to avoid confusion.

    Yet, the a.out output I see is from a different program.

    I deleted a.out using the rm command

  10. #10
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by muthus View Post
    I am compiling a simple 'hello world' the program using the following command

    gcc filename.c

    I made sure I have write permissions on a.out and the directory. I have each source in a separate directory to avoid confusion.

    Yet, the a.out output I see is from a different program.

    I deleted a.out using the rm command
    If you type "which a.out", what do you see? Do you see the a.out in your hello world directory, or a different one?

  11. #11
    Registered User
    Join Date
    Jan 2008
    Posts
    17
    I am seeing a different one. I see the one in /usr/bin. But, I worked around this problem by directing the output to a file different that a.out

  12. #12
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by muthus View Post
    I am seeing a different one. I see the one in /usr/bin. But, I worked around this problem by directing the output to a file different that a.out
    OK, then. Just remember that your current directory is not in your path (or high up in your path), so to run a file where you are you can do "./a.out" (in other words, giving a directory as well as a file name).

  13. #13
    Registered User
    Join Date
    Jan 2008
    Posts
    17
    Got you. Thanks a lot.

  14. #14
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Seems a little odd that you have an a.out in /usr/bin.

    Perhaps investigate how it got there. Is it one of yours you've moved there accidentally?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  15. #15
    Registered User
    Join Date
    Jan 2008
    Posts
    17
    Agree. Will do some investigation. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. *** glibc detected *** a.out: realloc()
    By msshapira in forum C Programming
    Replies: 9
    Last Post: 01-27-2009, 09:49 AM
  2. General a.out redirection question under Linux
    By merixa in forum C++ Programming
    Replies: 3
    Last Post: 11-07-2005, 05:36 PM
  3. Change Name of a.out
    By cdonlan in forum Linux Programming
    Replies: 2
    Last Post: 02-01-2005, 04:51 AM
  4. window remains active
    By lambs4 in forum Windows Programming
    Replies: 2
    Last Post: 05-07-2004, 02:15 AM
  5. overgrown .exe files
    By R.Stiltskin in forum C++ Programming
    Replies: 13
    Last Post: 04-09-2004, 11:19 AM