如何在 C++ 中创建头文件Xcode 3.1.2 中的项目?
我正在尝试在 xcode 3.1.2 中创建一个头文件。这就是我所做的。
我启动 xcode,创建一个新项目并将其另存为 Tricycle。
然后他们问我:为你的新项目选择一个模板。 弹出菜单,我进入命令行实用程序选择“C++ 工具”。
一旦我在已经存在的 main.cpp 上完成该项目,我将其保存为项目文件夹 Tricycle 中的 main.hpp (我什至尝试过 main.h)(顺便说一下,该目录在我的桌面上,我没有更改任何关于它到哪里到达源代码的信息)。
现在,我知道通过将其另存为 .hpp 已经取得了一些成果:这是因为图标从蓝色 C 变为栗色 H。
我打开了一个新项目,我打算将其另存为一个.cpp,再次称为TricycleNew -->命令行实用程序 --> c++ 工具。
一开始我编码:#include“main.hpp”
,它说该目录不存在。
请帮助我,我是编程新手,尤其是 xcode,我想提高我的学习水平,但由于这个障碍我不能。
蚂蚁的想法?
I am trying to create a header file in my xcode 3.1.2. Here's what I do.
I start up xcode, I do a new project and save it as Tricycle.
Then they ask me: Choose a template for your new project.
The menu pops up and I go to COMMAND LINE UTILITY to select the "C++ tool".
Once I do the project on the already existing main.cpp, I save it as a main.hpp (I even tried main.h) in the project folder Tricycle (which by the way has the directory on my desktop, I did not change anything as to where it goes to reach the source code).
Now this is how I know I've achieved something by saving it as .hpp: it's because the icon changes from that with a blue coloured C to a maroon coloured H.
I open up a new project, the one I intend to save as a .cpp, called TricycleNew, again --> command line utility --> c++ tool.
In the beginning I code: #include "main.hpp"
and it says that directory doesn't exist.
Please help me out, I'm new to programming and especially xcode and I want to advance in my learnings but I can't because of this roadblock.
Ant ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您正在做太多项目。您只需要一个项目,然后需要向该项目添加其他文件(文件 -> 新建文件 -> 头文件)。
It seems like you are making too many projects. You only need one project, and then you need to add additional files to that project (File -> New File -> Header File).