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.