My Compiler is newer than my book (VC++)

Started by
5 comments, last by benryves 14 years ago
Ok so I am working through this second edition of Beginning Game Programing. He is using 2003 Visual C++ and I am using the more recent express version. But none of the source code will compile. If I convert the source projects from the cd to 2008 they will run, but when I type them from a new project they will not. I've found my way around a few (Adding 'A' to the end of some functions) but it isn't getting me through most of these errors. Do I need to turn unicode off on my project or something? Is there a way to tell the compiler to treat my code differently? or did I just buy a paperweight? I thought C++ was backward compatible? thanks [Edited by - unicoder on March 26, 2010 9:48:16 PM]
Advertisement
Quote:I've found my way around a few (Adding 'A' to the end of some functions) but it isn't getting me through most of these errors.
Yeah, it sounds like you may need to turn unicode off (if I'm remembering my WinAPI correctly).
Quote:I thought C++ was backward compatible?
It's not quite that simple. C++ is a complicated language, and even today, stuff will compile with VC++ that won't compile in GCC (and presumably vice versa). This is due to various non-standard extensions (which can usually be disabled), but also simply due to how the standard is interpreted and/or to what degree various aspects of it are enforced by each compiler. Furthermore, Visual Studio 2003 is known for being pretty flaky with respect to the standard (in its defense, the standard had not been established for very long at the time it was developed).

API-related issues (like the ones you're running into with WinAPI) are a separate issue. Even if the language stays the same, building projects that made use of previous versions of the APIs in question can be problematic due to changes in the underlying system(s) or in the APIs themselves.
Yes change Character set to Multi-Byte. Also why did you get 1st ed? there is a 2nd of that book?
I am using the second edition. Alot of my books were damaged and I just picked this one up to replace my first edition. I paid $30 for it today just to freshen up on my winapi (been using other languages/api's) and nothing will run. I was hoping to write this next project of mine in visual but its being annoying. Hopefully I'll be able to switch back to unicode when I start writing my Direct X :/


EDIT: Thanks changing it away from Unicode worked.
Quote:Original post by unicoder
I am using the second edition. Alot of my books were damaged and I just picked this one up to replace my first edition. I paid $30 for it today just to freshen up on my winapi (been using other languages/api's) and nothing will run. I was hoping to write this next project of mine in visual but its being annoying. Hopefully I'll be able to switch back to unicode when I start writing my Direct X :/


EDIT: Thanks changing it away from Unicode worked.





ohh sorry meant 3rd edition it is all VS 2008. That is one I have. glad you got it working though
atleast you still have yours, wife threw my entire collection of 3d programming, C++ reference, engine, etc etc away. Ive been here 10 years, I had collected alot of good lit. :/
Alternatively, use the supplied macros; TCHAR instead of char, TEXT("string literal") instead of "string literal" etc. This should then work whatever the project settings are.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

This topic is closed to new replies.

Advertisement