Dev-C++ Library Test Project

Let’s double check the configuration of your Dev-C++ project to get it prepared to link in the game engine and all support libraries required at this point (including the DirectX libs). Open the Project menu and select Project Options. When you create the project, be sure to add the Main.cpp file located one folder above the project folder (that is, TestEngineMain.cpp, not TestEnginedevcppMain.cpp, which is incorrect).

First things first. Click the Directories tab and add a new item to the list of Library Directories. We’re going to tell Dev-C++ where it can find the engine library. Add an entry with this text: ....Enginelib (assuming your game engine project is located in the Engine folder—change if needed). See Figure 1.10.

Figure 1.10. Setting the location of the game engine library in the Dev-C++ project.


Next, click on the Parameters tab. On the right is a text field labeled Linker. Enter all of the following items into the Linker field:

  • -lAdvanced2D

  • -ld3d9

  • -ld3dx9

  • -ldxguid

  • -lwinmm

These are the library files required by the program. The linker is a program that takes all of the object files (.o for GCC) and combines them into a single executable file that’s ready to run. See Figure 1.11.

Figure 1.11. The Linker field includes the complete list of libs required by the project.


Advice

Although the Dev-C++ library file was specified as libAdvanced2D.a, we do not enter the entire name into the linker options. In GCC-land, the prepended lib and the extension are both assumed. Thus, libAdvanced2D.a is added as a linker option using -lAdvanced2D.


You must make one last setting, and then you can compile the project. We need to tell Dev-C++ where to put the resulting executable file, because the default is not a good location. Do you remember back when you were creating the engine library project and you configured Dev-C++ to send the file to a folder called .lib? Well, for an executable, we want the output to go to .in (which is short for binary). The .in folder is where you will save game assets that the executable needs to load up, so we might as well get into the habit of doing this for each project now. Open the Project Options again. Click the Build Options tab. In the Executable Output Directory field, enter .in. For the Object File Output Directory field, enter .obj, as shown in Figure 1.12.

Figure 1.12. Setting the output folders for the project.


Finally, it’s time to compile! To compile the program in Dev-C++, press Ctrl+F9 or use the Execute menu. You may also just press F9 to build and run (if there are no compile errors). In order to run the program, you will need to copy the d3dx9.dll file into the same folder as the TestEngine.exe file. This dll is provided on the CD-ROM (duplicated in every chapter’s project folders for convenience).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset