Learning to compile C++ in Xcode(学习在 Xcode 中编译 C++)
问题描述
我已经开始在学校广泛使用 c++,现在我的程序已经到了有超过 1 个文件(即头文件、驱动程序、实现文件)的地步.我对软件开发的了解不够,无法通过查看苹果的指南来理解或掌握如何设置构建过程.有人可以教我如何在 xcode 中编译一个带有头文件和两个 C++ 文件的简单 C++ 项目吗?我首先需要制作一个makefile吗?
I have started using c++ extensively in school and now my programs are getting to the point where have more than 1 file (i.e. header, driver, implementation file). I don't know enough about software development to understand or get a grasp of how to setup the build process by looking at apple's guides. Could someone walk me through how to compile a simple c++ project with a header and two c++ files in xcode? Do I first need to make a makefile??
推荐答案
在 Xcode 中:
- 选择文件 -> 新建项目...
- 选择 Mac OS X -> 应用程序 -> 命令行工具(我假设您正在制作一个使用 stdin/stdout 的简单 C++ 应用程序,而不是基于 Cocoa 的 GUI)
- 对于类型",选择C++ stdc++"
- 点击选择..."并为项目指定名称和位置
- 选择要添加到项目中的文件(标头和 .cpp 文件).
如果您打算将 Xcode 用作主要 IDE,您将需要了解有关 Xcode 的更多信息.Xcode 有很多文档,但其中大部分是为创建 Cocoa 应用程序的人设计的.对于开发简单的 C++ 控制台应用程序,您可以从 Xcode 工作区指南.
You will want to learn more about Xcode if you are going to use it as your main IDE. There's a lot of documentation for Xcode, but most of it is designed for people creating Cocoa apps. For developing simple C++ console apps, you can probably start with the Xcode Workspace Guide.
这篇关于学习在 Xcode 中编译 C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:学习在 Xcode 中编译 C++
基础教程推荐
- CString 到 char* 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
