[Solved] “unknown type name ‘size_t'” error from included .cpp file, but removed when included file name changed to .h file. Why? [closed]


The problem was not in the code. In my Makefile, I mistakenly put $^ instead of $< as below.

%: %.c include/*.h
    $(CROSS_COMPILE)gcc -g -fmax-errors=5 -DQEMU -I$(AXPUDIR) -I$(INCDIR) $^ -o $@

So the make tried to compile the header file (which I put as prerequisite, to make it recompiled when I change the header file) which errors out because by itself the header file didn’t have definition fo size_t. So I changed $^ to $< and the problem is gone. I feel sorry for misleading..

solved “unknown type name ‘size_t'” error from included .cpp file, but removed when included file name changed to .h file. Why? [closed]