search sequence for include path when compiling
rj45rt at hotmail.com
Tue Nov 29 18:37:09 MST 2005
I work on a porting program. It is compiled with another tool originally.
I should compile it with gcc now. A problem occurs when I use the gcc 3.3.2.
There is a 'time.h' in '/usr/include/sys' path, it relates to timer
definition. There is also a 'time.h' in application software due to the
historical cause. It is not conflicted with the original compile tool, but
the confliction occurs when compiled with gcc. There are different
definitions in these two files.
For normal compiling, it will report confliction in '/usr/include/sys' and
'/application'. I copy the application to my local directory to modify the
time.h. Before I modify the file, a strange thing happens. The confliction
disappears. The cause is that the path '/application' is changed to
'/mylocal'. I removed the 'time.h' file from application software and
rebuild. No error occurs. It seems the compiler dose not search the
'/mylocal' path to find 'time.h' any more. But it finds other application
header file in '/mylocal' path.
I think the compiler mush have a sequence to search include file, who can
help me to explain it in detail?
Express yourself instantly with MSN Messenger! Download today it's FREE!
More information about the PLUG