I made a little makefile to build a static library made of several object files. Then I made a test program test.exe and I built it with the same makefile. Executable is made of test.c and the static library to test.
When I change one function in one of the .c source files, makefile recognizes the change and rebuilds the .o file, then the .a archive file, and finally the test executable. All the files are modified, as the OS time attribute is changed at the time I run makefile.
But now when I run test.exe, I see from the output that the function I modified is still an older version. I can see it by changing a printf format string and noticing that the screen output is still the same as the older format. If I hard delete the lib.a from disk (i.e. move it to the recycle bin), and I run makefile again, now test.exe has the correct version of the changed function.
Why? Is ar creating a cache somewhere and using that? How can I work around this annoying thing?
The environment is:
- Windows 7
- Mingw64 (i686-8.1.0-win32-dwarf-rt_v6-rev0)