Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'iostream' file not found Xcode

Tags:

c++

io

xcode

c++11

Whenever I try to use Xcode 11 to build C++ programs and type in the line:

#include <iostream>

An error saying "'iostream' file not found shows up. The library I am using is libc++ and not libstdc++.

Other people dont seem to encounter this problem so I do not know what is going on.

#include <iostream>
using namespace std;

int main()
{
    cout << "Hey, this really works!" << endl;
}
like image 741
TheDarkLord Avatar asked Dec 23 '22 21:12

TheDarkLord


1 Answers

We encountered the same problem while using a C++ class with Objective-C wrapper.

While checking the build command we found Xcode was passing objective-c as the language for clang. On changing the Wrapper file extension to '.mm', XCode started passing language as objective-c++ and the error was gone.

like image 93
Rara dida Avatar answered Dec 25 '22 23:12

Rara dida