I have noticed g++ failing to compile a program when a directory is included with '-I' but succeeding when '-isystem' is used. I am trying to understand the exact nature of special treatment by gcc/g++ when searching directories that are to be treated as 'system' directories . All the notes I came across talk of suppressing some warnings but nothing that would explain why the compilation fails or succeeds. The version of g++ is g++ (GCC) 3.3.3 (SuSE Linux) I am enclosing a specific example below with two command lines, identical except for the fact that one uses '-isystem' and the latter uses '-I' . The former can compile the test program , but the latter fails. To test the issue, local copies of the following system directories were used in compiling the above file. The names of these system directories (in the same order shown below) have been reported by g++ when the '-v' flag was used. /usr/include/g++ /usr/include/g++/x86_64-suse-linux /usr/include/g++/backward /usr/local/include /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/include /usr/x86_64-suse-linux/include /usr/include For the test case, the -'nostdinc' and '-nostdinc++' flags were used to prevent g++ from searching the actual system directories under /usr. Instead, -I and/or -isystem were used to force it to search only the local copies of the same directories (note the '.' at the beginning of the paths). Details follow : The test program is /////////////////// test.c //////////////////////////////////////////////// #include <stdio.h> #include <time.h> extern "C" struct tm *localtime_r(const time_t *, struct tm *) ; int main (int argc, char ** argv) { time_t now; struct tm l_time; now = time((time_t *)NULL); localtime_r(&now, &l_time); printf("%s", asctime(&l_time)); return 0; } /////////////////////////////////////////////////////////////////////////////////////// The following two command lines illustrate the example. They are identical except for the use of '-isystem' for ./usr/include , as opposed to '-I'. The following command line compiles successfully. g++ -nostdinc -nostdinc++ test.c -I./usr/include/g++ -I./usr/include/g++/x86_64-suse-linux -I./usr/include/g++/backward -I./usr/local/include -I./usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/include -I./usr/x86_64-suse-linux/include -isystem./usr/include The following command line fails to compile. g++ -nostdinc -nostdinc++ test.c -I./usr/include/g++ -I./usr/include/g++/x86_64-suse-linux -I./usr/include/g++/backward -I./usr/local/include -I./usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/include -I./usr/x86_64-suse-linux/include -I./usr/include The compile error is error: declaration of `tm* localtime_r(const time_t*, tm*)' throws different exceptions usr/include/time.h:244: error: than previous declaration `tm* localtime_r(const time_t*, tm*) throw ()' can somebody please explain what is going on ? TIA -- View this message in context: http://www.nabble.com/what-is-the-exact-nature-of-special-treatment-to-%27system%27-directories-tf3310144.html#a9207728 Sent from the gcc - Help mailing list archive at Nabble.com.