2015-06-21 35 views
-1

你怎么做如何在xcode中包含<stdio>? C++

#include <stdio.h> 
在Xcode

我得到所有这些错误。

enter image description here

+0

是否安装了命令行工具? – albertoqa

+0

如何检查?顺便说一句,我所做的是Xcode->新建 - >项目 - > OSX应用程序 - >命令行工具 –

+0

在终端中运行'$ xcode-select -p',输出是什么? – albertoqa

回答

3

std::ofstream#include <fstream>
对于std::string#include <string>

<stdio.h>是功能所需的C头,如printffopen。它包括这样的:#include <stdio.h>。在C++中,最好是#include <cstdio>,因此所有名称都嵌入在namespace std中(因此您应该使用std::printf等)。

-1

你是C程序员吧?

<stdio.h>是C的I/O库。我想你正在寻找这个(C++的I/O库):

#include <iostream>