Joon. P
Joon. P

Reputation: 2298

How to include <stdio> in xcode? C++

How do you do

#include <stdio.h> 

in xcode?

I get all these errors.

enter image description here

Upvotes: 0

Views: 12287

Answers (2)

You're a C programmer huh?

<stdio.h> is C's I/O library. I think you're looking for this (C++'s I/O library):

#include <iostream>

Upvotes: -1

Anton Savin
Anton Savin

Reputation: 41321

For std::ofstream you #include <fstream>.
For std::string you #include <string>.

<stdio.h> is a C header needed for functions such as printf or fopen. It's included like this: #include <stdio.h>. In C++ it's better to #include <cstdio> instead, so all names are embedded in namespace std (so you should use std::printf etc).

Upvotes: 3

Related Questions