Reputation: 1671
I'm developing a C program and oddly as I update the source files I don't see any change in the resulting executable. Is it possible gcc stores a cached copy of the files and even if I compile I don't get the newer version of my executable? In this case how can I force the compiler to use the newly edited files?
I am compiling my code with the following:
# gcc -o myExecFileName source_file_1.c source_file2.c
Upvotes: 5
Views: 10045
Reputation: 5505
To answer your question, no gcc will not cache your files. Something else is going on. You are either changing files in a different directory as @Lee D suggests, or you are not saving the files before compiling, or perhaps the changes you are making are ifdef'd out.
Upvotes: 3
Reputation: 116
Check to make sure you are editing the same files you are compiling. If you are working with multiple versions of files in multiple windows, that might not be the case. Happened to me last week.
Upvotes: 0
Reputation: 30867
It sounds like your makefile is out of whack. make
uses file times to determine whether or not to run a compilation step. You have to have your dependencies in order for it to work correctly, though.
Observe:
hello: hello.c
$(CC) hello.c -o hello
On the first line, hello: hello.c
means look at the timestamp on the file hello.c
, and if it's older than the timestamp on hello
(or if hello
doesn't exist), then run the compliation specified below.
Upvotes: 0