简体   繁体   English

如果添加了像$(SRCROOT)/ Library这样的搜索路径,如何调用库文件夹中文件夹内的头文件?

[英]How do i call the header files that are inside folders in my library folder if i added search path like this $(SRCROOT)/Library?

I have a hierarchy like this in my project 我的项目中有这样的层次结构

  • Library 图书馆
    • xfolder 文件夹
      • xh h
      • xc c
    • yfolder 文件夹
      • yh h
      • yc c
  • sample 样品
  • sampleTests sampleTests
  • Frameworks 构架
  • Products 产品展示

I added a $(SRCROOT)/Library in my Header search paths so i can call my headers inside the library folder. 我在标题搜索路径中添加了$(SRCROOT)/ Library,以便可以在库文件夹中调用标题。 My question is do i still add a directory for it? 我的问题是我仍要为其添加目录吗? like if xc wants to include yh do i place #include yh or #include yfolder/yh ? 例如,如果xc要包含yh,我应该放置#include yh还是#include yfolder / yh吗?

I'd really appreciate answers, I'm still new to this and i want to add headers from ffmpeg source and it's really a lot of headers. 我非常感谢您回答,我对此还很陌生,我想从ffmpeg源添加标头,这确实有很多标头。 Thanks 谢谢

您可以使用相对路径,如下所示:#include“ ../yfolder/yh”

I can think of the following ways of #include ing yh in xc . 我能想到的下列方式#include ING yhxc

  1. Use path relative to $(SRCROOT)/Library 使用相对于$(SRCROOT)/Library路径

     #include <yfolder/yh> 
  2. Use path relative to xc 使用相对于xc路径

     #include "../yfolder/yh" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我是否需要在共享库中显式包括一个公共头文件(在include路径文件夹中)? - Do I need to explicitly include a common header file(in an include path folder) used in shared library? 如何在Mac的标头包含路径中添加Allegro(或任何库)? - How do I add Allegro (or any library) to the header include path on Mac? 仅标头库不使用标头保护。 如何在其他头文件中使用该库? - Header only library doesn't use header guards. How can I use the library in other header files? 我怎样才能像 stdio 一样使用我的 C 库 - How can I use my C library as others like stdio 如何在CMake中检查头文件和库函数,就像在Autotools中一样? - How to check header files and library functions in CMake like it is done in Autotools? 如何在不使用stdio.h或任何其他库头文件的情况下将字符写入C中的标准输出? - How do I write a character to standard output in C without using stdio.h or any other library header files? 如何手动将.h文件导入系统库? - How do I manually import .h files into the system library? 如何包含openssl / md5库的目标文件? - How do I include the object files for openssl/md5 library? 如何组织库中的头文件 - How to organize header files in a library 如何在Xcode 6中向C项目添加库 - How do I add a library to my C project in Xcode 6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM