Problem linking libraries

Started by
8 comments, last by guy_with_a_pexel 20 years, 8 months ago
I just finished with c++, now I am wanting to get into directX, but I can''t seem to find how you link the directX libraries using dev c++. Cna anyone give me step by step instructions? Thanks
Advertisement
It''s just not that simple. DirectX is a collection of APIs such as Direct3D, DirectSound, DirectShow, etc. First, you have to know which API you are going to be using. Then, you can figure out which library(s) to link to.
I know this, I just need to know how to link those specific APIs and make them work right.
There is no linking to an API, there is only linking to libraries.

First, figure out what your trying to code, then go to the MSDN and figure out what libraries youll need. For DirectPlay, youll most likely need to include dplay8.h

You can set your includes under

project > settings > link.......then add the library you want to ad manually in the text field.
Start by writing simple WIn32 applications, if you havent allready.
If I recall, you need to include d3d9.h and link to d3d9.lib..
Though, I''m not 100 % if the file names are exact.
Now you include d3d9.h by #include <d3d9.h>, but how do you link to d3d9.lib correctly?
can anyone tell me that?
DevC++ uses Mingw32 as the compiler, which is a Windows port of gcc. The library (object) format MSVC understands is not understood by gcc, so you need to get the files in a format that it understands. At the DevC++ website (and with the included update utility) you can download packages that contain library files gcc can understand. Your first step would be to get the DirectX 9 package and install it. Then, in the DevC++ project settings, there is a place where you can type in the names of the libs to link to. As I recall there is a browse feature so you can just select the libs you want.

Another thing to keep in mind is the naming convention. When using other Win32-based compilers you link to somelib.lib. But with gcc compilers you link to libsomelib.a. So d3d9.lib is not what you would put in the project settings, but libd3d9.a instead. Just bop around the DevC++ website a bit and you''ll find what you need.
with dev c++ just run the updater and choose the DX9 package and download it. i think it has some example projects, so you can look how to link to the library.
great thanks guys, I definitely understand now, you were very helpful
Is there any helpful sites or what not that can teach me how to use directX 9? Or can I stick to my DirectX 8 book?

This topic is closed to new replies.

Advertisement