just picked up a book called c++ for absolute beginners by mark lee
like it so far...but im battling with some things.
his examples are written for ms visual c++ studio 2008 and im using 2010
when i copy and try to run i get errors...
why is this happening...is there a huge difference between 08 and 2010?
whats the best thing to do? get a book for 2010 or down grade to 08?
or can this be addressed?
below are the errors i get...
please help...im anctious to get started...
1>------ Build started: Project: hello world, Configuration: Debug Win32 ------
1> helloworld.cpp
1>c:\users\user\documents\visual studio 2010\projects\hello world\hello world\helloworld.cpp(2): warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\users\user\documents\visual studio 2010\projects\hello world\hello world\helloworld.cpp(2): warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\user\documents\visual studio 2010\projects\hello world\hello world\helloworld.cpp(10): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
warning C4067: unexpected tokens following preprocessor directive - expected a newline
Well, according to your warnings, it appears as though you have trailing characters at the end of a preprocessor directive.
warning C4627: '#include <iostream>': skipped when looking for precompiled header use
It appears as though Visual Studio/Express is expecting you to place include directives in Stdafx.h.
To get around the Stdafx.h header, you can disable it in your project options. Just look for Precompiled Headers under the C/C++ node.
is there a book i should use with visual c++ 2010 to learn c++ or is pretty normal to begin with...ie would i have problems regardless of book / compiler combination...ie it requires tweaking.
thanks for the response...you guys are great...
lastly....can you coders out there type really fast? i mean should i learn to touch type? i use 6 fingers and am not that slow...but wondered how much of an impact this would have
Note that this online tutorial is pretty basic. The first link I gave you goes a lot deeper, and is very much worth owning. I still refer to it from time to time.
Incidentally, in my opinion you are wasting your money by buying super basic books on programming. They give you very little bang for the buck.
If you really want to learn to program, buy books that go a bit deeper. You'll be glad you did.
The two books I gave you above might be considered introductory by experienced programmers, but they contain a lot more meat than "Such And Such A Book For Dummies", and so on.
If you work through Prata's book, the second link I gave you, you will have a very sound basic understanding of C/C++ programming.
Lamblion i cant thank you enough man!!! i have just ordered both books...do you recommend i read them intermitently or start the first one cover to cover,then the next?
cant wait...do the books come with a compiler or do i use visual c++ express 2010.
look, i dont want to kid myself either...i currently work in a computer shop...i am reading a book on DNS and MCITP as well as trying to get into slackware during the day. i can only dedicate a couple of hours at night to C++, do you think im wasting my time...
i dont want to go career, but i feel my computing lacks a sense of creativity i used to have when i used to program in basic on my c64, when i was like 14.
it would be nice to write a few things i could use. my wife is studying Action script / j querry so
i thought i would stay away from java to be different...i was also thinking about python...
thanks again
its cause of good people like you that i still have faith in this world...
TSN
I would work through the first portion of Prata's C++ Primer Plus before you get into Petzold's book. Once you covered eight or ten chapters in Prata's book you'll understand enough to work some things out in Petzold.
It just takes staying at it until things begin to come together.
And yes, most definitely use VS C++ Express. It is a great tool for beginners and has the most support, and also, of course, many pros, if not most pros, use VS 2010 as well.
One more thing. Petzold's book comes with a CD with all the programs on it. I don't remember if Prata's does or not.
Either way, I recommend that you type all the examples in yourself instead of pasting from the CD. You'll learn and retain a whole lot more that way.
Just be sure to gain a basic understanding of C/C++ from at least the first portion of Prata before you get into Petzold, for most everything in Petzold is based on at least a basic understanding of C/C++.