XCode 不会将子目录中的 C++ 源文件添加到编译源中 [英] XCode does not add c++ source files that are in subdirectories into Compile Sources

查看:19
本文介绍了XCode 不会将子目录中的 C++ 源文件添加到编译源中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 XCode 5.1 进行 C++ 开发.我有通过从 Finder 拖动文件添加到项目的现有代码.该项目显示了所有必需的 .h.cpp 文件.但是当我单击 Build Phases->Compile Sources 时,我只能看到来自我的源结构中根目录的源.子目录中的任何源文件都不会出现在编译源中.为什么?以及如何解决这个问题?

I use XCode 5.1 for C++ development. I have existing code which I add to the project by dragging files from Finder. The project shows all necessary .h and .cpp files. But when I click Build Phases->Compile Sources, I only see sources that from the root directory in my source structure. None of the source files from subdirectories appear in the Compile Sources. Why? And how to fix this?

此外,当我尝试通过按 +Build Phases->Compile Sources 添加丢失的 .cpp 文件时,XCode 会不展开子目录,所以我无法选择丢失的 .cpp 文件.

Also, when I try to add the missing .cpp file from Build Phases->Compile Sources by pressing +, XCode does not expand the subdirectories, so I cannot select the missing .cpp files.

推荐答案

这太不可思议了.唯一的问题是,我使用为任何添加的文件夹创建文件夹引用选项而不是为任何添加的文件夹创建组来添加文件夹结构.

This is unbelievable. The only problem was that I was adding folder structure with Create folder references for any added folders option instead of Create groups for any added folders.

但是还是不明白在识别源文件方面有什么区别.

But still don't understand what is the difference in terms of recognition of source files.

其他特点是您应该以相反的方式添加资源文件(为任何添加的文件夹创建文件夹引用).否则,iOS 应用程序找不到文件且无法编译.

Other peculiarity is that you should add resource files in opposite way (Create folder references for any added folders). Otherwise the iOS application does not find the files and does not compile.

这篇关于XCode 不会将子目录中的 C++ 源文件添加到编译源中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆