We want to add a file to the Cocos2d-x directory in either of the following ways:
First, right-click in the navigation bar and choose Add files
Second, drag the file directly.
However, either way, we will face one option, namely the Folders option:
As shown in, there are two options for Folders:
Create groups for any added folders
Create folder references for any added folders
If you select the first method to add a file, we will find the added file, the folder is yellow
The second method is selected. The folder of the file to be added is blue.
What are the differences between the two methods?
1. use Create groups for any added folders to Create a group for any newly added folder. The group concept may be unfamiliar to us, you can manually add a Group in the project (right-click and select New Group), but the Group you manually add does not actually exist in the project directory, you will find that the file added to the groups is still in its original location, but the groups introduced from the outside will not, as we did just now. Once a groups object is created or added, it is in the form of a yellow folder. When you want to use the header file of a class in the folder, you can directly add its reference, for example
# Include xxx. h
This is because the cpp file under groups will be compiled.
2. using the Create folder references for any added folders method only creates a reference to the file, and these files are not compiled. Therefore, you need to add the path when using the file, for example, if we want to use a header file under the myScripts folder, we need to add the declaration as follows:
# Include myScripts/xxx. h
Otherwise, the compiler will tell you that the xxx. h file cannot be found.
This is the difference between the yellow folder and the blue folder in the project and how to use it.
As for the Destination option, if you select this option, if the file you want to introduce is not in the directory of your project file, xcode automatically copies the file to the directory of your project.
If you do not select the file and the file is not in your project directory, the file can still be used, but once you copy the project to another place, this file cannot be found. Because this file is on your computer, not in your project.