Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

me2

Help for a newbie - compiling in Visual C++

This topic is 6913 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve gained a fair amount of knowledge in C++, and wanted to try to learn how to program some simple games. I went out and purchased one of LaMothe''s books, but am having a difficult time compiling the examples there. Up to this point, I''ve been using Borland for everything, and have never needed to compile anything very complex. I recently purchased Visual C++ since I heard it was much better than Borland when dealing with DirectX, but I''m having problems getting any of the examples to compile correctly. Could anyone out there offer some suggestions as to what I need to do (step by step, if possible) in order to get a DirectX program to compile correctly with Visual C++? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Try looking in the DirectX SDK Help. There is a section on "Compiling DirectX Applications" or something similar. It will tell you exactly what you need to do.

I may be missing a step, but right off the top of my head, you need to go into Project / Settings and add dxguid.lib and ddraw.lib (at the minimum). Then, you also need to go into Tools / Options (I think) and add the include directory to where you installed your SDK.

If there is anything else you need to do, it should be in the SDK help.

Share this post


Link to post
Share on other sites
The first thing you need to do is to point your compiler to the DX libs and headers. Go to Tools->Options->Directories, then on the include files tab you need to add the DX header directory. Then move it to the top of the list. Repeat by including the DX libs directory on the library files tab.

You then need to write the names of any libs you need for you project in project->settings->link.

You need to add any source files to the project in
project->add to project->files

You can then press the compile button and off you go!

BTW I understand why newbies have trouble using VC++, why on earth don''t MS include a manual!!

-- Jon Hobson --

Share this post


Link to post
Share on other sites
Yeh but if M$ gave a nice manual with their products what would M$ Press do with themselves.

I would be interested in which version your using. I''ve just downgraded from v5 to v6. And I''ve been haunted by wizards once more. Creating win32 App and it throws up a bloody wizard. Any one knows which option just brings up a BLANK project like I''m used to in v5!



What else do you need; besides a miricle.
Money. Lots of Money. or I''ll never do a sequel!

Share this post


Link to post
Share on other sites
I''m using version 6. Yeah, it definately doesn''t help that no decent manual is included. I bought one of LaMothe''s books in hopes of learning about game programming (I think it''s ''Tricks of the Windows Game Programming Gurus'' or something like that), but can''t get any of the exaples he''s included to compile! I keep getting some ''unexpected end of file error''. Well, hopefully some of the suggestions above will help.

Share this post


Link to post
Share on other sites
I do it a bit different, I put the directx libs and headers in the lib and header folder of vc++, then change the project->settings to include ddraw.lib, winmm.lib, dsound.lib etc... Just a bit easier. And you also have to include the header files in your code like

#include >ddraw.h< //change the < and >

or whatever you need.

Share this post


Link to post
Share on other sites
Here are the steps you have to follow in VC++:

1. Check the dirctories for the includes and libs. Go to Tools->Options. Go to the Directories tab. From the list in the right choose Include files and browse to the dir where the inclue are (usually MVC_dir\include), the choose Library files and browse to the dir where the libs are (usually MVC_dir\libs)

2. Go to Project->Settings. Choose Settings for all configurations. Go to the Link tab and add ddraw.lib dinput.lib dsound.lib or what ever components of dx you use to the object/libraries.

3. Include in your .cpp or .h files
#include <ddraw.h>
#include <dinput.h>
#include <dsound.h>

or what ever components of x you use.

Hope it helps.

Octavian
E-mail: octavsoft@octavsoft.freeservers.com
Webpage: octavsoft.freeservers.com

Share this post


Link to post
Share on other sites
Also check to make sure you are using the correct version of ddraw.lib and all the other DirectX libraries. I added those libraries once to game I was using that uses the DirectX 7 interfaces, after I downloaded the DirectX 7a SDK, and I kept getting a whole bunch of errors, "Interface not found..."

And after some research on my computer I found that MS Visual C++ 6 my version installed some lame ddraw.lib file in its library probably from DirectX 3, which NT supports. So I repointed my libraries to the ones that where installed in the DirectX 7a subfolders, and voila! It worked.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!