I want to write a C++ program in XCode on my Mac. I wrote this basic one to test it. When I build, I get a "Build Successful" message.
我想在我的Mac上写一个c++程序,我写了这个基本的程序来测试它。当我构建时,我得到一个“构建成功”的消息。
However, I cannot run it! If I hit Command+R nothing happens. When I go to Project->Run the Run option is disabled.
但是,我不能运行它!如果我点击Command+R,什么都不会发生。当我去项目->运行的选项是禁用的。
#include <iostream>
using namespace std;
int main()
{
cout << "helo" << endl;
}
1 个解决方案
#1
66
- Launch XCode
- 发射XCode
- In the "Choose template" box, pick Mac OS X, then Command Line Tool. Press Next
- 在“选择模板”框中,选择Mac OS X,然后是命令行工具。按下一个
- Give your project a name, select C++ as the type
- 给您的项目命名,选择c++作为类型。
- You should see a new project with main.cpp
- 您应该会看到一个与main.cpp有关的新项目。
- press the Run button
- 按下运行按钮
-
At the bottom of the screen, under All Output you should see:
在屏幕底部,在所有输出下,你应该看到:
Hello, World!
Program ended with exit code: 0你好,世界!程序以退出代码结束:0。
#1
66
- Launch XCode
- 发射XCode
- In the "Choose template" box, pick Mac OS X, then Command Line Tool. Press Next
- 在“选择模板”框中,选择Mac OS X,然后是命令行工具。按下一个
- Give your project a name, select C++ as the type
- 给您的项目命名,选择c++作为类型。
- You should see a new project with main.cpp
- 您应该会看到一个与main.cpp有关的新项目。
- press the Run button
- 按下运行按钮
-
At the bottom of the screen, under All Output you should see:
在屏幕底部,在所有输出下,你应该看到:
Hello, World!
Program ended with exit code: 0你好,世界!程序以退出代码结束:0。