views:

72

answers:

2

Hello! My source code in Visual C++ Express 2008 is as follows :

#include “stdafx.h”
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << “Hello world!\n”;
return 0;
} 

I'm using the book, Visual C++ 2008,by Ivor Horton

.These are the errors that I'm encountering.How do I get rid of the errors ?

1>e:\my documents\visual studio 2008\projects\hello\hello\hello.cpp(1) : error C2006: '#include' : expected a filename, found 'identifier'
1>e:\my documents\visual studio 2008\projects\hello\hello\hello.cpp(1) : fatal error C1083: Cannot open include file: '': No such file or directory

Thanks!

+5  A: 

Use double quotes " to surround stdafx.h and Hello world!\n

Currently you are using some inverted quotes/quotation marks.

codaddict
thanks for pointing that out , but i tried it and it doesnt work unfortunately
Anant
What error do you get after making change?
codaddict
a whole new set actually : 1>e:\my documents\visual studio 2008\projects\hello\hello\hello.cpp(2) : warning C4067: unexpected tokens following preprocessor directive - expected a newline1>e:\my documents\visual studio 2008\projects\hello\hello\hello.cpp(5) : error C2065: '“Hello' : undeclared identifier1>e:\my documents\visual studio 2008\projects\hello\hello\hello.cpp(5) : error C2146: syntax error : missing ';' before identifier 'world'
Anant
and : 1>e:\my documents\visual studio 2008\projects\hello\hello\hello.cpp(5) : error C2065: 'world' : undeclared identifier1>e:\my documents\visual studio 2008\projects\hello\hello\hello.cpp(5) : error C2143: syntax error : missing ';' before '!'1>e:\my documents\visual studio 2008\projects\hello\hello\hello.cpp(5) : error C2017: illegal escape sequence1>e:\my documents\visual studio 2008\projects\hello\hello\hello.cpp(5) : error C2065: 'n”' : undeclared identifier
Anant
@Anant: You also need to change the quotes around your `Hello world!\n`
codaddict
Thanks a lot sir :D
Anant
+3  A: 

If you copied the code example directly from your source code, it seems that you have Unicode curly double quotes ( Unicode | U+201C (decimal: 8220) ) when the compiler is expecting ASCII double quotes ( ASCII | 34 (hex: 22 | octal: 0042 | binary: 00100010) | Unicode | U+0022 (decimal: 34) )

teukkam