Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Starting Directx


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Kaezin   Members   -  Reputation: 158

Like
Likes
Like

Posted 23 August 2001 - 02:03 PM

Okay I got the book Tricks of the Windows Game Programming Gurus, and managed to get all the way to the DirectDraw part (that''s an accomplishment for me! =D), but now I don''t know how to configure VC++ for it (or at least I think that''s my problem). I am getting the following errors: C:\Game\Game.cpp(59) : error C2146: syntax error : missing '';'' before identifier ''lpdd4'' C:\Game\Game.cpp(59) : error C2501: ''LPDIRECTDRAW4'' : missing storage-class or type specifiers C:\Game\Game.cpp(59) : fatal error C1004: unexpected end of file found Error executing cl.exe. I have the Directx 8 SDK and put in the include directory of the DX8 SDK in the project options. I also put in the ddraw.lib in the project options. But now I have no idea what to do... can anyone help? It''s probably some stupid thing that I did (I''m used to it)

Sponsor:

#2 Sheep   Members   -  Reputation: 152

Like
Likes
Like

Posted 23 August 2001 - 02:47 PM

This is taken from the "Hands on forum." I couldnt get it to work, but after reading this it did. If you want to read it directly just go to the forum... its under the "Readiness Test" topic.





Tell the IDE Where to Look

Move to Tools|Options|Directories , and you’ll see a list of locations that the IDE searches through when looking for project files. We’re not talking about our files here – they’re all in the project’s directory and therefore easy for the IDE to find. No, what the compiler is really going to have a hard time finding without our help is all of the DirectX header files that we intend to use.

So, here’s what you do. Where did you install your DirectX SDK? Mine is at C:\DXVCSDK , so I’ll use that as an example (substitute with your own). All of the DirectX header files are located in the INCLUDE subdirectory, so you’d add an entry like this to the list:

C:\DXVCSDK\INCLUDE

Now that you have it in the list, and this is very important, move the entry up until it’s the very first one. The reason for this is because MSVC comes with some older DirectX header files, and if the IDE looks in the MSVC default directories before trying yours, things will be screwed-up.

Tell the Linker Where to Look

The IDE may now know where all of the header files are (in our project directory and in the DirectX SDK include directory), but it also needs to know where the ‘real’ DirectX code libraries are. After all, the header files only contain prototypes (kind of like usage instructions) for the DirectX components – the components themselves are in DLL files on your system. What the linker needs to do is know which libraries (files with linking instructions) are needed for our project. We’ll be looking at compiling and linking in a later article, but for now here’s what I’m talking about:

Our project uses these files:

DDRAW.H

DINPUT.H

DSOUND.H


…which contains prototypes for the DirectDraw, DirectInput and DirectSound components we’re using. The actual components (the DirectX runtimes) are called:

DDRAW.DLL

DINPUT.DLL

DSOUND.DLL


…which are the files that everyone has for playing DirectX games with. Finally, we have library files that connect code using DirectX components:

DDRAW.LIB

DINPUT.LIB

DSOUND.LIB


Okay, so just read this next sentence very carefully and you’ll be fine: Our source code is compiled with instructions contained within header files, and linked with instructions contained in library files, which ultimately allow our code to use the components in the runtime (DLL) files.

So, where was I? Oh yeah… Head to Project|Settings|Link , and you’ll see an edit field called Object/library modules . You may even see some entries already here, all ending in .LIB. All we need to do is add our library files here, and they happen to be located in a directory called LIB inside our main DirectX folder. What I do is add this to the front of the library list:

C:\DXVCSDK\LIB\*.lib

If there are other libraries in this list already, leave them after yours (separated by a space). Now, there happens to be one other library that we’re using (for our sound code), so you’ll need to add WINMM.LIB to this list as well. So, to recap, let’s say that when you first showed up in this dialog, the edit box showed something like:

SOMELIB.LIB OTHERLIB.LIB YETMORE.LIB…

(Whatever their names actually are, who cares). Now it should be:

C:\DXVCSDK\LIB\*.lib WINMM.LIB SOMELIB.LIB OTHERLIB.LIB…

Got it?


#3 Kaezin   Members   -  Reputation: 158

Like
Likes
Like

Posted 23 August 2001 - 02:57 PM

Okay that solved the problem (I think), but now I have these two errors:

Linking...
Game.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw4
Debug/Game.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

I''ve had these errors before when I tried to compile some other projects, I have NO IDEA what the hell I should do about it... I don''t know how to fix it either.

#4 Midnight Coder   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 August 2001 - 03:07 PM

If you do the above, it should work. Are you sure you included all the libraries?

#5 Kaezin   Members   -  Reputation: 158

Like
Likes
Like

Posted 23 August 2001 - 03:44 PM

Here is my library thing from VC++:

c:\dx6\lib\ddraw.lib c:\dx6\lib\dsound.lib c:\dx6\lib\dinput.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Btw I''m using directx6 (following Tricks book)
I don''t think I need the dsound and dinput but you can''t be too careful

#6 Midnight Coder   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 August 2001 - 03:57 PM

Try including dxguid.lib.

You can also just include the whole folder by adding 'c:\dx6\lib\*.lib'

Edited by - Midnight Coder on August 23, 2001 10:58:51 PM

#7 Kaezin   Members   -  Reputation: 158

Like
Likes
Like

Posted 23 August 2001 - 04:02 PM

Wow thank you so much! That solved everything! I thought that Deej just put the * there so he didn't have to repeat himself =D It compiled flawlessly (even without the warnings I usually get hehe), wow I really can't thank you enough, to the both of you guys.

Fixed many typos in my excitedness hehe

Edited by - Kaezin on August 23, 2001 11:03:40 PM

#8 Midnight Coder   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 August 2001 - 04:06 PM

Your welcome, I''m glad you got it working.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS