Advertisement

Visual C++ basic help

Started by October 22, 2000 09:02 PM
7 comments, last by Turtlebread 24 years, 2 months ago
I recently aquired a version of VC++ from a friends brother who was giving up programming in disgust. I learned C/C++ from a book, and used Codewarrior to compile them. Then, I got Tricks of the Windows Game Programming Gurus, and when trying to compile a sample program, all sorts of errors pop up. I have a feeling that its the fact that I don''t know how to USE VC++, rather than the program itself is flawed. Anyway, what is the best way to learn how to use the compiler? I have the MSDN cds, but I can''t find any really basic tutorials. Most of the stuff is for the new features of VC++, not on the basics. Can anyone point me in the right direction to learning the basics of compiling/linking a program with multiple headers\libraries etc? -Chris
As far as I recall, Sam''s Teach Yourself Visual C++ In 21 Days (not so sure about the exact title) was allright. It teaches MSVC beginners the basic features of MSVC and how to use MFC. You might wanna have a look at it. Just to get shure. In fact, there are quite a few MSVC books out there. Just run a search on amazon.com or go to a local bookstore and have a look.

I find there are surprisingly little good online tuts and articles on MSVC.

"Mr Sandman bring me a dream"
-----------------------------"Mr Sandman bring me a dream"
Advertisement
well if you plan on doing game programming (which I assume you are), then DONT get Sams Teach Yourself Visual C++ in 21 days. The only thing that it teaches you is how to use MFC which you DONT want to use in making games. Maybe mapeditors or something like that, but not the games themselves.

"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

I thought TOTWGPG had enough in it to get you going with the compiler. You really only need to know the basics to start using it with ease, and then you''ll pick up the more advanced stuff later. You might try looking in Appendix B of the book... otherwise post the specific errors you''re getting and I''ll try to help you out.

-Ironblayde
 Aeon Software

The following sentence is true.
The preceding sentence is false.
"Your superior intellect is no match for our puny weapons!"
Thanks for your responses. Here are the errors I get when I try to compile the first sample program. It contains blackbox.h, blackbox.cpp, freakout.cpp, and ddraw.lib according to the book. I have added each of the files to the project but when I try to compile, I get this:


--------------------Configuration: freakout - Win32 Debug--------------------
Compiling...
blackbox.cpp
d:\source\t3dchap01\blackbox.h(34) : error C2146: syntax error : missing '';'' before identifier ''lpdd''
d:\source\t3dchap01\blackbox.h(34) : fatal error C1004: unexpected end of file found
freakout.cpp
d:\source\t3dchap01\blackbox.h(34) : error C2146: syntax error : missing '';'' before identifier ''lpdd''
d:\source\t3dchap01\blackbox.h(34) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

freakout.exe - 4 error(s), 0 warning(s)

I''m pretty sure its something I havent done right..I have the Direct X SDK installed, and the ddraw.lib is directly from the folder. Please respond if you know what I''m doing wrong.

-Chris
It seems to me like you are missing a semi-colon on line 34 of "blackbox.cpp". Try double clicking the error message in the output box (down the bottom) and checking for a semi-colon on the end of the line.

Also, you have to make sure you have added the .lib files to your project. Go to Project->Settings->Link and add "ddraw.lib" in the box with all the other .lib files.

- Daniel
VG Games
- DanielMy homepage
Advertisement
Since it says that you''re missing a semi-colon before the identifier lpdd, I assume that the line in question looks something like this?

LPDIRECTDRAW7 lpdd;

or LPDIRECTDRAW4, or whatever. In any case, when the compiler tells you that you need a semi-colon *before* an identifier, the problem is usually that the data type is not being recognized. In this case, the most likely culprit is an old version of the DirectDraw header being included. Make sure you have the latest SDK installed and your include directories have the SDK directories as the FIRST entries. If that doesn''t work, maybe there''s a spelling error? Like LPDIRECDRAW7?

-Ironblayde
 Aeon Software

The following sentence is true.
The preceding sentence is false.
"Your superior intellect is no match for our puny weapons!"
I just a recent problem, i was trying to compile the program in the article entitle x-tasy byt he authore of your book. Anyway it gave me like three semicolon erros, the same ones you got(but on different lines obviosly), anyway I got pissed off, and stuck a semicolon in front of them. That solved that problem and the program compiled, but would not link. Then i just read the think deakin said about the project->setting->link thing. I added ddraw.lib, and the thing works fine now. Thanks and i hope this works for you.
something...
Well, thanks to the suggestions here, I got the program to work(woohoo!). I just needed to add the include and lib directories to the compiler by going to Tools->Options->Directories. I had to point it to the Direct X folder. Apparently, even though I added ddraw.lib, it was using an older version of Direct X, thus the errors. Again, thanks to all the help.
-Chris

This topic is closed to new replies.

Advertisement