I am on Arch Linux. I have tried gcc and cc.
I have quite a strange problem. I have a file included from /usr/include (installed from an Arch package) in a C program like so.
// prog.c
#include <foobar/foobar.h>
When I change it, nothing happens. Let me explain. It includes some C code.
// foobar/foobar.h
int baz = 1, qux = 2;
Recently, it has been updated.
// foobar/foobar.h
int baz = 1, qux = 2, norf = 3;
My test program looks something like what follows.
// prog.c
#include <foobar/foobar.h>
printf ("%d %d %d\n", baz, qux, norf);
output:
error: ‘norf’ undeclared (first use in this function)
I can duplicate the file in the same directory, name it foobar2.h, and then include that file instead and it outputs:
1 2 3
So the path is not incorrect. I can make a link to the folder, name it foobar2, and include foobar2/foobar.h and it outputs:
1 2 3
So the file is not incorrect.
To confirm that it is not registering changes, I can destroy the foobar folder entirely and try to print just the 2 variables that were originally inside the header. This outputs:
1 2
Clearly something is not updating. The same behaviour is displayed when I try updating the file with enums, functions, or new values for existing items in the file, and include them as the only lines in the file. None of the changes register. The same activity is displayed with gcc and cc. This has been going on a few months now and it still has not resolved itself.
When a file does not seem to be updating, it is a good idea to check other places on your system where your compilers search for libraries for identically named folders. In this case, it was in /usr/local/include, where I had a version that I compiled and forgot about entirely.