Hello,
, I'm trying to learn how to program by reading: "Programming -- Principles and Practice Using C++ (Second Edition)", by Bjarne Stroustrup. Yet I'm stuck at chapter 2, where I'm supposed to create my first program. In my search for a solution I've found many other that has similar problems, although their solutions has allowed me to avoid their errors - I'm now stuck at another error.
Here's the code for the program:
1 2 3 4 5 6 7 8 9
|
// This program outputs the message “Hello, World!” to the monitor
#include "../../../std_lib_facilities.h"
int main() // C++ programs start by executing the function main
{
cout << "Hello, World!\n"; // output “Hello, World!”
return 0;
}
|
And a link to the header I'm supposed to use:
http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h
The instructions that I'm following (word-files):
http://www.stroustrup.com/Programming/include-std_lib_facilities.doc
http://www.stroustrup.com/Programming/Installing-Visual-Studio-express.doc
I've attempted to follow them step-by-step.
And the error I get when I try to build the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Severity Code Description Project File Line Suppression State
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 7
Error C2065 ' ': undeclared identifier HelloWorld c:\users\grauth\documents\visual studio 2015\projects\helloworld\helloworld\helloworld.cpp 8
Error C2143 syntax error: missing ';' before 'return' HelloWorld c:\users\grauth\documents\visual studio 2015\projects\helloworld\helloworld\helloworld.cpp 8
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 7
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 7
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 7
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 7
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 7
Error C3873 '0xa0': this character is not allowed as a first character of an identifier HelloWorld c:\users\grauth\documents\visual studio 2015\projects\helloworld\helloworld\helloworld.cpp 7
Error C3872 '0xa0': this character is not allowed in an identifier HelloWorld c:\users\grauth\documents\visual studio 2015\projects\helloworld\helloworld\helloworld.cpp 7
Error C3646 ' ': unknown override specifier HelloWorld c:\users\grauth\documents\visual studio 2015\projects\helloworld\helloworld\helloworld.cpp 6
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error (active) unrecognized token HelloWorld c:\Users\Grauth\Documents\Visual Studio 2015\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 5
Error C3873 '0xa0': this character is not allowed as a first character of an identifier HelloWorld c:\users\grauth\documents\visual studio 2015\projects\helloworld\helloworld\helloworld.cpp 5
Error C3872 '0xa0': this character is not allowed in an identifier HelloWorld c:\users\grauth\documents\visual studio 2015\projects\helloworld\helloworld\helloworld.cpp 5
|
My most recent idea is to downgrade to "Visual Studio Express 2010", since the author mentions the version in the instructions. Yet I have almost no knowledge of programming - so I assume there's a better solution, and maybe you know of it? Or a better way to troubleshoot the problem?
Your help is highly appreciated!
/Nils