I just recently installed OSX lion and got xcode 4.
I made a file in a directory somewhere and put this code in it:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!";
return 0;
}
Then I ran gcc filename.cc
and I get these errors:
1.cc:3:20: error: iostream: No such file or directory
1.cc: In function ‘int main()’:
1.cc:8: error: ‘cout’ was not declared in this scope
what’s wrong?
EDIT:
if I run g++ filename.cc I get the same errors.
1.cc:3:20: error: iostream: No such file or directory
1.cc: In function ‘int main()’:
1.cc:8: error: ‘cout’ was not declared in this scope
Why are you using gcc? Use g++ instead.