学习在 Xcode 中编译 C++

2023-10-17C/C++开发问题
19

本文介绍了学习在 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++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

    The End

相关推荐

无法访问 C++ std::set 中对象的非常量成员函数
Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)...
2024-08-14 C/C++开发问题
17

从 lambda 构造 std::function 参数
Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)...
2024-08-14 C/C++开发问题
25

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

使用 std::atomic 和 std::condition_variable 同步不可靠
Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)...
2024-08-14 C/C++开发问题
17

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么禁止对存储在 STL 容器中的类重载 operator&()?
Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)...
2024-08-14 C/C++开发问题
6