XCode 不会将子目录中的 C++ 源文件添加到编译源中 [英] XCode does not add c++ source files that are in subdirectories into Compile Sources
问题描述
我使用 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屋!