How to compile DirectX Program

Source: Internet
Author: User

When compiling a DirectX program, errors such as "error c2061: syntax error: identifier 'lpdirectdrawsurface7'" always occur, even if the DirectX SDK is installed, this is really a hit for beginners who are just eager to go to game development. But it doesn't matter. I will explain in detail the cause of the problem and its solution.

First, to develop the DirectX program, you must install the DirectX SDK, which can be found on the Internet. The 9.0 SDK is about 227;

After the installation is complete, you can design the DirectX program. We generally know that to use the SDK, it must contain its header file and Lib library. Refer to the sample provided by the SDK, make a simplest DX program, but we will immediately find that even if we include # include "ddshow. H "and other required header files, including dxguid in settings. lib, ddraw. lib, dsound. library files such as lib always encounter such errors during compilation:

G:/... xx. H (209): Error c2061: syntax error: identifier 'lpdirectdrawsurface7'

Of course, it means that I don't know the guy "lpdirectdrawsurface7", so good, from tools-> options... -> directories: Set the dx sdk include directory (for example, if your SDK is installed under the dxsdk of D: disk, the include directory is D:/dxsdk/include) add, add the lib directory of the dx sdk, compile, and dizzy. I still don't know the lpdirectdrawsurface7 symbol, and suddenly think of the sequence of searching for the compiler, re-enter tools-> options... -> in directories, move the dxsdk directory in include to the first line, compile, and OK @_@

However, there is a new situation at this time:

XX. OBJ: Error lnk2001: unresolved external symbol _ directdrawcreateex @ 16

XX. OBJ: Error lnk2001: unresolved external symbol _ iid_idirectdraw7

The link symbol directdrawcreateex cannot be found. The same problem is that the new header file is included and the old lib library is linked. Therefore, some functions cannot be found. Similarly, go to tools-> options... -> in directories, move the dxsdk directory in lib to the first line, compile, and OK.

Summary: In general, the header file cannot be found. We can think of the problem that the SDK directory cannot be found. In tools> options... -> you can add the corresponding include and Lib directories in directories. However, the following errors often make us confused. Because these errors are added, it is easy to ignore the issue of directory order.

Over.

 

 

 

Related Article

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.