The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> C Programming
|
A question about gcc...
Discuss A question about gcc... in the C Programming forum on Dev Shed. A question about gcc... C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 5th, 2003, 02:27 PM
|
 |
Contributing User
|
|
Join Date: Jun 2002
Location: Tampa, Florida
Posts: 31
Time spent in forums: 1 h 11 m 29 sec
Reputation Power: 12
|
|
|
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
|

June 5th, 2003, 03:03 PM
|
 |
Contributing User
|
|
Join Date: Jan 2003
Location: USA
|
|
|
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.
|

June 5th, 2003, 03:55 PM
|
 |
Contributing User
|
|
Join Date: Jun 2002
Location: Tampa, Florida
Posts: 31
Time spent in forums: 1 h 11 m 29 sec
Reputation Power: 12
|
|
Quote: 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.
Quote:
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.
Quote:
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
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|