Code: Select all
#include <iostream.h>
main()
{
cout << "Hello, World!\n";
return 0;
}
Code: Select all
#include <iostream>
int main()
{
std::cout << "Hello, World!\n";
return 0;
}
Zadeh wrote:I wouldn't be surprised if one month ago you were using a different compiler.
Your code should look like:
Which compiles fine with icc 7.0 and g++ 3.2.1 over here. icc is sometimes more strict by default in what it accepts as legal.Code: Select all
#include <iostream> int main() { std::cout << "Hello, World!\n"; return 0; }

Put this in your codeThere is another way, setting the std so you don't need to change every cout.
Code: Select all
using namspace std;Code: Select all
#include <iostream>
int main()
{
std::cout << "Hello, World!\n";
return 0;
}
Code: Select all
using namespace std;
#include <iostream>
int main()
{
cout << "Hello, World!\n";
return 0;
}
Code: Select all
#include <iostream>
int main()
{
cout << "Hello, World!\n";
return 0;
}
Code: Select all
test.C(1):error: name must be a namespace name
using namespace std;
^
Everything was OK before upgrade at that time. icc worked perfectly with C++ code.Starfox wrote:Sorry for asking something stupid, but are you sure you compiled your C++ program with icpc and NOT with icc
( the icc is the C, the icpc the C++ compiler from intel!)