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

10.7k views Asked by At

How do you do

#include <stdio.h> 

in xcode?

I get all these errors.

enter image description here

2

There are 2 answers

0
Anton Savin On BEST ANSWER

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).

0
99ProblemsAndTheyreAllCode On

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>