[SOLVED] gcc compiler is not compiling old C Programming files beacuse of timestamp issue
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
gcc compiler is not compiling old C Programming files beacuse of timestamp issue
Hi,
I am using makefile to complile all C Programming files. But certain files are not getting compiled and hence its object file is not getting generated. This is happening due to files haven't been modified for a long time. It seems that compiler knows that its object file is there hence no need to complie it actually it is not.
Hi,
I am using makefile to complile all C Programming files. But certain files are not getting compiled and hence its object file is not getting generated. This is happening due to files haven't been modified for a long time. It seems that compiler knows that its object file is there hence no need to complie it actually it is not.
Please suggest how to overcome the issue.
How is that an issue? That's the whole point (well, at least
a major part of it) of "make" - you only compile what needs
to be compiled rather than the whole source tree...
Thanks for the suggestions. Yes, my makefile is compiling only some files. Now I have updated the makefile to the current date and it is working fine. This problem comes sometimes only. But I want to know the reason why it happens if file becomes too old and has no modification in it.
I am using makefile to complile all C Programming files. But certain files are not getting compiled and hence its object file is not getting generated. This is happening due to files haven't been modified for a long time. It seems that compiler knows that its object file is there hence no need to complie it actually it is not.
Yes. Exactly. That's one of the main BENEFITS of using "make", is that it DOESN'T recompile the world - it only does what's necessary. And, in this case, it looks like "make" believed (probably correctly!) that it didn't NEED to recompile most of your object files. That's a Good Thing
Quote:
Did you try "make clean"?
Quote:
Q: But I want to know the reason why it happens
Simple: if your source file is NEWER than the object (or, more precisely, if the "target" is older than its "dependency") then no action is needed.
It's a standard convention to have a "clean" target in any makefile, so you can FORCE recompilation if you wish to.
Quote:
Also, you can try running "rm *.o" in all subdirectories where .o files are
Actually some other file was also generating the exe file of same name where my source file is present. Hence it was no getting compiled as it sees an exe file already created. I deleted that exe file and now it was working successfully.
Once again thanks for the help and support you all provided to me. I came to know lot many new things.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.