我把a.h、a.cpp文件放在目录D:\a;把b.h、b.cpp放在D:\a\b中,现在新建一个c.h、c.cpp,请问在c.h中如何使用#include来包含a.h和b.h?

解决方案 »

  1.   

    #include "d:/a/a.h"
    #include "d:/a/b/b.h"
      

  2.   

    如果a和c都在目录D:\a中
    #include "a.h"#include "b\b.h"
      

  3.   

    问题已经解决!非常感谢!
    请问#include "b\b.h" 和#include "b/b.h" 有啥区别?
      

  4.   

    请问#include "b\b.h" 和#include "b/b.h" 有啥区别?没有区别,不过为保持通用和习惯,应该用 #include "b/b.h"最好不要用绝对路径,可以在编译选项里加 /I 或-Ixxx 之类添加头文件的搜索路径