gcc如何查找头文件(查找路径)

  • 摘要

    search path.

  • How does gcc find the header files

  1. commond
    `gcc -print-prog-name=cc1plus` -v
    

    This command asks gcc which C++ preprocessor it is using, and then asks that preprocessor where it looks for includes.

  • Tell the gcc to go the the dictinary to find header

-I dir_name

Add the directory dir_name to the head of the list of direectories to be searched for header files.This can be used to override a system header file, substituting your own version, since these directories are searched before the system header file dirctories.

  • References

  1. Where does gcc look for C and C++ header files?
  2. How to tell the gcc to look in the include folder for the header files?

猜你喜欢

转载自blog.csdn.net/The_Time_Runner/article/details/107968048