Jason Heyes wrote:
I compile this program using Microsoft Visual C++ 6.0:
#include <cstdio>
int main()
{
std::printf("Hello world");
return 0;
}
It gives me the following error message:
Main.cpp
C:\Projects\Examples\Main.cpp(5): error C2653: 'std': is not a class or
namespace name
How do I stop this? Thanks.
VC++6 is broked in this regard, at least in the version you (and it
turns out I) have. The most portable work-around is to not use the new
header, but the "C compatibility" version.
#include <stdio.h>
int main()
{
printf("Hello world\n");
return 0;
}
That header is deprecated, but is liable to be part of the standard for
a long time to come. BTW, I added a new-line to the output string, you
should have that in yours as well.
Brian