#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Tampa, Florida
    Posts
    31
    Rep Power
    13

    A question about gcc...


    Well, since there are some things that aren't a good idea in PHP, I've been working on my C skills. And having a lot of good luck too. I can't complain.

    Something seems strange with gcc. Does it keep a cache of files of some sort? Here is what's going on. I am updating a dock app (wmbluecpu) to give the user options in text and load color. Pretty simple for the most part as it involves creating some addtional xpm files and capturing the additional arguments at the command line.

    However, when making some changes to these xpm files (I deleted a couple that I bunged up!), I started seeing compiler errors. Now I'm sorry that I didn't capture the output. I didn't think about, but the problem has been dealt with for the most part.

    Anyway, those errors were relating to failed includes of those deleted xpm files! That seems to suggest to me that the compiler is caching on some level. Anybody ever see
    any behaviour like this.

    Cheer,
    BDKR
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,216
    Rep Power
    2222
    Are you just using gcc by itself from the command line, or with a makefile, or from within an integrated development environment (IDE)? If the latter two cases, then you might be blaming gcc for what they're doing.

    If you're using a makefile, then the dependencies might not set up accurately. Normally in doing a make, the timestamp of the object files are checked against those of the corresponding source files and the object is only recompiled if any source that it depends on is more recent. The dependency list of the makefile is how make knows which source files each object depends on. If that dependency list is inaccurate, then an object file might not get updated when it needs to be, which can cause the program to behave incorrectly even to the point of crashing.

    gcc can generate a dependency list for you. Assuming that all the .c files in a directory are part of your project:

    gcc -MM *.c

    Then you can capture that list and insert it into your makefile.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Tampa, Florida
    Posts
    31
    Rep Power
    13
    Originally posted by dwise1_aol
    Are you just using gcc by itself from the command line, or with a makefile, or from within an integrated development environment (IDE)? If the latter two cases, then you might be blaming gcc for what they're doing.
    It's from a makefile.


    If you're using a makefile, then the dependencies might not set up accurately. Normally in doing a make, the timestamp of the object files are checked against those of the corresponding source files and the object is only recompiled if any source that it depends on is more recent. The dependency list of the makefile is how make knows which source files each object depends on. If that dependency list is inaccurate, then an object file might not get updated when it needs to be, which can cause the program to behave incorrectly even to the point of crashing.
    I wonder if screwing around with different copies of the same file is what did it. It seems to be working fine now.


    gcc can generate a dependency list for you. Assuming that all the .c files in a directory are part of your project:

    gcc -MM *.c

    Then you can capture that list and insert it into your makefile.
    That's good 411! I had better go back and check the man page eh?

    Thanx!,
    BDKR

IMN logo majestic logo threadwatch logo seochat tools logo