Solution to source code compilation problems in Chapter 4th of C ++ Game Development

Source: Internet
Author: User

1. Open Dev C ++ and Click Tools> check for updats/pakages. 1:
 
Figure 1
2. Select devpaks.org community devpaks option from the select devpak server drop-down list, and click check for updats:
 
Figure 2
3. After checking that the update is complete, check the openal option and click Download selected. 3: (if the download fails, download the openalfile on the http://download.csdn.net/source/1853440link directly)
 
Figure 3
4. After the installation is complete, there will be a OpenAL-0.099-mingw folder under C:/dev-CPP (the premise is that your Dev is installed under the C disk), enter, copy all files in the include folder to C:/dev-CPP/include, and copy all files in the Lib file to C:/dev-CPP/lib, then copy the openal32.dll In the Lib file to C:/Windows/system32 (I use the XP system, and other systems may be slightly different ).
5. Run the source code in the book
(Note: If you build a project in the order of creation in the book, the error 4 will be reported. The reason is unclear. You are looking for the project. If you have any answers, please let us know)
 
Figure 4
5.1 run the code in the CD. I copied the prog_04_01 folder to drive D:/prog_04_01, and copied the llamaworks2d folder to drive D:/llamaworks2d, in this way, the project can reference the engine file normally, or you can set the path in Dev.
Click project> project options, 5:
 
Figure 5
5.2 select compiler-> linker and change "do not use standard system startup files or libraries" to "no" (yes by default; check this option; otherwise, compilation fails), as shown in Figure 6:
 
Figure 6
5.3 add openal and OpenGL Libraries
Right-click the project name and select project options, 7:
 
Figure 7
In the pop-up dialog box, select parameters and add: ALUT. a, libopenal32.a, Alu. a. C. a. libwinmm. a. libopengl32.a (pay attention to the Order, otherwise the compilation reports an error), 8:
 
Figure 8
6. After all this is done, the exciting time is reached. Press F9 and run. The running result shown in "9" is successful.
 
Figure 9
Note: I personally think C ++ game development is a very good book, which is a step-by-step and well-explained in a simple way. However, due to compilation problems in unit 4th, this book seems to be no longer published in China and recalled in foreign countries. I think this problem occurs, it may be due to the configuration problem of the dev compiler. It is not the default value of the compiler. Changing the "yes" option to "no" option in step 1 is a description, I guess the memory error at the beginning may also be related to the configuration, if you have time, you can compare the differences between the dev project configuration parameters created by yourself and the dev project configuration parameters provided by the author, and you may find problems.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.