Hi all, I would like to start learning c++ programing, but I do not know where to start. I wish to start helping with a project I am very interested in, and was given a site to compile the code, and a book to check out. The only problem is, when I get to the Hello World project, I get really stuck. I am using Visual C++ Express 2010, and both books are a bit outdated (2004 and 2008).
Let me get into a bit of detail:
I copy paste from the ebook
1: #include <iostream>
2:
3: int main()
4: {
5: std::cout << “Hello World!\n”;
6: return 0;
7: }
I save, I compile, then this comes up
------ Build started: Project: test, Configuration: Debug Win32 ------
first.cpp
c:\documents and settings\family\my documents\visual studio 2010\projects\test\test\first.cpp(1): error C2059: syntax error : 'constant'
c:\documents and settings\family\my documents\visual studio 2010\projects\test\test\first.cpp(1): error C2014: preprocessor command must start as first nonwhite space
c:\documents and settings\family\my documents\visual studio 2010\projects\test\test\first.cpp(2): error C2059: syntax error : 'constant'
c:\documents and settings\family\my documents\visual studio 2010\projects\test\test\first.cpp(3): error C2059: syntax error : 'constant'
c:\documents and settings\family\my documents\visual studio 2010\projects\test\test\first.cpp(4): error C2143: syntax error : missing ';' before 'constant'
c:\documents and settings\family\my documents\visual studio 2010\projects\test\test\first.cpp(4): error C2447: '{' : missing function header (old-style formal list?)
c:\documents and settings\family\my documents\visual studio 2010\projects\test\test\first.cpp(5): error C2017: illegal escape sequence
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I would hardly call 2004 and 2008 outdated... the newest standard, C++0x, just came out. Before that, the last update was 2003. Any book in that time frame should be sufficient.
C++ Books released in 2004 and 2008 are not that outdated . The last official standard was released in 1998 with some later addendum. However, Visual C++ 2008 with SP1 has new features that will be available on the next C++ standard publication, so far named C++0x. The best tutorial to start in my opinion is at this web site. I also would consult Stroustrup ( C++ creator ) web site, he has a great C++ FAQ. He also has two books, one is C++ The Programming Language ( avoid this right now, but read it later of course, the best C++ reference on earth in my opinion ) and the other is a book to introduce C++ and programming, which I did not read yet, but I could bet that it is excellent.
I just went through the list and tried to write little programs for each topic. If there's anything you don't understand, google it and you'll get your answer.