简体   繁体   中英

Xcode - header files issue with .cpp file

I have imported my project from windows to mac and Is using xcode to compile the project.

I have managed to fix most error and bugs from the porting process but there is one bug/error I am unable to determine why its not working as it should. This probably due to my lack of knowledge of xcode but was wondering if anyone is able to help me with this problem.

The problem is this; I have a two sub folders in my project, once called include and another called source. Of course include contains all the header files and source contains all the cpp files and such.

Example:

Root/
    Include/
            Header.h
    Source/
           test.cpp

Now in the build settings in the xcode project, I have added $(SRCROOT)/Include/ in the Header Serach Paths. So therefore I presume that xcode will include any header files in the Include folder.

So in the test.cpp class I add #include "Header.h" . When I click build I get an error saying "'Header.h' file not found".

Im not entirely sure what I am doing wrong, of course I can do this for example - #include "../Include/Header.h" but that's going to be a pain going through all the cpp files in my project (which is a lot).

I was just wondering if anyone else came across this problem?

Thanks for reading.

通常,您需要将标题添加到“ User Header Search Paths ,如果您在XCode中搜索帮助,则会为您提供传递目录所需的格式。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM