Hi, Does anyone know how to avoid linker ignores undefined symbols? My problem is that, when the first time you do the rebuild all, the compiler can know there are undefined symbol, but if you build (i.e. link, not build all) the project, the linker can link it without errors nor warnings. I don't want this potential issues. Thank you, Snaku
Hi Tamir Michael,
Sorry, I did not describe the problem clearly. I write a example code to explain my problem. This example code is no problem when you compile it, but if you change the 'ITEM_2' to 'ITEM_foo' in the test.h, and use 'build target' this protect again (not rebuild all), the compiler will not tell you any thing wrong, only use 'rebuild all' can detect the undefined symbol. My question is that how to avoid this potential issue when you use 'build target'.
file: test.h
enum{ ITEM_1, ITEM_3 };
file: test.c
#include "test.h" #include <stdio.h> int main(void) { printf("ITEM 1 = %d",ITEM_1); printf("ITEM 2 = %d",ITEM_2); }
Thank you, Snaku
sorry, the 'test.h' in last message should be
enum{ ITEM_1, ITEM_2 };