Sample compilation errors and solutions in the SDK
Compiling environment of Sample In SDK
If you use Microsoft Visual Studio 2005, go to the tools> Options> projects and solutions> VC ++ directory and perform the following settings.
Executable file:
D:/program files/Microsoft Visual Studio 8/VC
D:/program files/Microsoft Visual Studio 8/VC/redist/debug_nonredist/x86
/Microsoft. vc80.debugmfc
D:/program files/Microsoft Visual Studio 8/VC/lib
D:/program files/Microsoft Visual Studio 8/VC/atlmfc/lib
D:/program files/Microsoft Visual Studio 8/VC/atlmfc/include
D:/program files/Microsoft Visual Studio 8/VC/include
D:/dxsdk/lib
D:/dxsdk/bin
D:/dxsdk/samples/C ++/DirectShow/baseclasses
D:/dxsdk/samples/C ++/common/include
D:/dxsdk/include
Include files:
D:/program files/Microsoft Visual Studio 8/VC/include
D:/program files/Microsoft Visual Studio 8/VC/atlmfc/include
D:/program files/Microsoft Visual Studio 8/VC/platformsdk/include
D:/dxsdk/include
D:/dxsdk/samples/C ++/DirectShow/baseclasses
D:/dxsdk/samples/C ++/common/include
Library file:
D:/program files/Microsoft Visual Studio 8/VC/platformsdk/lib
D:/program files/Microsoft Visual Studio 8/VC/lib
D:/program files/Microsoft Visual Studio 8/VC/atlmfc/lib
D:/program files/Microsoft Visual Studio 8/VC
D:/program files/Microsoft Visual Studio 8/VC/atlmfc/include/i386
D:/dxsdk/lib
D:/dxsdk/samples/C ++/DirectShow/baseclasses/debug
D:/dxsdk/samples/C ++/DirectShow/baseclasses/release
D:/dxsdk/samples/C ++/DirectShow/baseclasses
1. parse the errors that occur when compiling dxsdk/samples/C ++/direct3d.
Error example:
Cvtres: Fatal error cvt1100: duplicate resource. Type: manifest, name: 1, language: 0 × 0409
Link: Fatal error lnk1123: failed during coff conversion: Invalid or corrupt file
Solution:
My compiling environment is Microsoft Visual Studio 2005
Select all properties of all projects (select all projects-> right-click-> Properties)-> Configure properties-> Configuration tool-> input/output-> embedded list, and select "no ", then compile the file, and then click OK.
2. Resolve the error that has not been declared.
Error example: for (m = 0; m <pdevice-> dwnummodes; m ++)
{
If (pdevice-> modes [M]. width = 640 & pdevice-> modes [M]. Height = 480)
{
Error c2065: "M": Undeclared identifier
For this type of error, you can find its definition before copying its definition to the row of the error. In the preceding example, you can add long m; in the previous line of ;. You can.
3. parse errors that cannot be initialized.
Error example:
Tchar * strlastslash = _ tcsrchr (STR, text ('//'))
Error: Error c2440: "initialization": cannot be converted from "const wchar_t *" to "tchar *"
For errors like this, you can perform forced conversion on the Right of =. As follows:
Tchar * strlastslash = (tchar *) _ tcsrchr (STR, text ('//'));
4. resolve the issue where the warning is regarded as an error.
Error example:
C:/dxsdk/samples/C ++/MISC/dxdiagreport/dxdiaginfo. cpp (322): Error c2220: Warning is regarded as an error-no "object" file is generated.
The cause of this error is that the code page of the file is in English, and the code page in our system is in Chinese.
Solution: Start Microsoft Visual Studio 2005, choose File> open> C:/dxsdk/samples/C ++/MISC/dxdiagreport/dxdiaginfo. cpp, and save the settings. Run the program file again. This error does not appear again.
If the preceding error cannot be removed, you can also click the project and right-click Select properties-> Configure properties-> C/C ++-> General, change the option "warning as error" to "no ". You can!
5. Compile baseclasses
Compiling...
Dllentry. cpp
D:/program files/Microsoft Visual Studio 8/VC/platformsdk/include/winnt. H (222): Error c2146: syntax error: Missing ";" (before the identifier "pvoid64)
D:/program files/Microsoft Visual Studio 8/VC/platformsdk/include/winnt. H (222): Error c4430: The type specifier is missing-it is assumed to be Int. Note: C ++ does not support default int
D:/program files/Microsoft Visual Studio 8/VC/platformsdk/include/winnt. H (5940): Error c2146: syntax error: Missing ";" (before the identifier "buffer)
D:/program files/Microsoft Visual Studio 8/VC/platformsdk/include/winnt. H (5940): Error c4430: The type specifier is missing-it is assumed to be Int. Note: C ++ does not support default int
D:/program files/Microsoft Visual Studio 8/VC/platformsdk/include/winnt. H (5940): Error c4430: The type specifier is missing-it is assumed to be Int. Note: C ++ does not support default int
D:/dxsdk/include/uuids. h: Warning c4819: The file contains characters that cannot be expressed in the current Code Page (936. Save the file as Unicode to prevent data loss.
The generated logs are stored in "file: // D:/baseclasses/debug_unicode/buildlog.htm"
Baseclasses-5 errors and warnings
Where an error occurs:
Typedef void * pvoid;
Typedef void * pointer_64 pvoid64;
Change:
# Define pointer_64 _ ptr64 // Gai
Typedef void * pvoid;
Typedef void * pointer_64 pvoid64 ;////
Error:./wxdebug. cpp (567): Error c4430: The type specifier is missing-it is assumed to be Int. Note: C ++ does not support default int
Error: static g_dwlastrefresh = 0;
Modify: static int g_dwlastrefresh = 0;
6. Compile capture and cannot open libci. Lib
Error: Link: Fatal error lnk1104: Unable to open the file "libci. lib"
The generated logs are stored in "file: // D:/dxsdk/samples/C ++/DirectShow/capture/capturetex/debug/buildlog.htm"
Capturetex-1 error and warning
Error cause: the Missing database libci. Lib does not exist in 2003 and 2005
Solution: point the library file to the library file in vc6.
Compile capture
Error: Link: Fatal error lnk1104: Unable to open the file "libci. lib"
The generated logs are stored in "file: // D:/dxsdk/samples/C ++/DirectShow/capture/capturetex/debug/buildlog.htm"
Capturetex-1 error and warning
Error cause: the Missing database libci. Lib does not exist in 2003 and 2005
Compile dmodemo
Error:
.../../Common/src/dsutil. cpp (686): Error c2065: "I": Undeclared identifier
Error:
If (I! = M_dwnumbuffers)
Return m_apdsbuffer [I];
Else
Return m_apdsbuffer [rand () % m_dwnumbuffers];
Change: Add unsigned char I before;
Compile dmosample
D:/dxsdk/include/dmoimpl. H (622): Error c2065: "DW": Undeclared identifier
D:/dxsdk/include/dmoimpl. H (588): Compile the class template member function "hresult imediaobjectimpl <_ derived _, numberofinputs, numberofoutputs>: processoutput (DWORD, DWORD, dmo_output_data_buffer *, DWORD *)"
With
[
_ Derived _ = csample,
Numberofinputs = 1,
Numberofoutputs = 2
]
D:/dxsdk/samples/C ++/DirectShow/DMO/dmosample/sample. H (21): see references for instantiating the "imediaobjectimpl <_ derived _, numberofinputs, numberofoutputs>" of the class template being compiled.
With
[
_ Derived _ = csample,
Numberofinputs = 1,
Numberofoutputs = 2
]
D:/dxsdk/include/dmoimpl. H (623): Error c2228: The left side of ". dwstatus" must have a class/structure/Union.
D:/dxsdk/include/dmoimpl. H (624): Error c2228: The left side of ". fincomplete" must have a class/structure/Union.
D:/dxsdk/include/dmoimpl. H (626): Error c2228: The left side of ". fincomplete" must have a class/structure/Union.
Sample. cpp
D:/dxsdk/include/uuids. h: Warning c4819: The file contains characters that cannot be expressed in the current Code Page (936. Save the file as Unicode to prevent data loss.
D:/dxsdk/include/dmoimpl. H (622): Error c2065: "DW": Undeclared identifier
D:/dxsdk/include/dmoimpl. H (588): Compile the class template member function "hresult imediaobjectimpl <_ derived _, numberofinputs, numberofoutputs>: processoutput (DWORD, DWORD, dmo_output_data_buffer *, DWORD *)"
With
[
_ Derived _ = csample,
Numberofinputs = 1,
Numberofoutputs = 2
]
D:/dxsdk/samples/C ++/DirectShow/DMO/dmosample/sample. H (21): see references for instantiating the "imediaobjectimpl <_ derived _, numberofinputs, numberofoutputs>" of the class template being compiled.
With
[
_ Derived _ = csample,
Numberofinputs = 1,
Numberofoutputs = 2
]
D:/dxsdk/include/dmoimpl. H (623): Error c2228: The left side of ". dwstatus" must have a class/structure/Union.
D:/dxsdk/include/dmoimpl. H (624): Error c2228: The left side of ". fincomplete" must have a class/structure/Union.
D:/dxsdk/include/dmoimpl. H (626): Error c2228: The left side of ". fincomplete" must have a class/structure/Union.
State. cpp
Stdafx. cpp
Util. cpp
Generating code...
The generated logs are stored in "file: // D:/dxsdk/samples/C ++/DirectShow/DMO/dmosample/debug_unicode/buildlog.htm"
Dmosample-8 errors and warnings
============ Generation: 0 succeeded, 1 failed, 0 latest, 0 skipped ==========
Change: Add dword_ptr DW before the wrong statement;
Compile playdvd
Linking...
Playdvd. OBJ: Error lnk2001: the external symbol "unsigned int (_ stdcall * ATL: g_pfngetthreadacp) (void )"(? G_pfngetthreadacp @ ATL @ 3p6gixza)
./Debug_unicode/playdvd.exe: Fatal error lnk1120: 1 external command that cannot be parsed
The generated logs are stored in "file: // D:/dxsdk/samples/C ++/DirectShow/DVD/playdvd/debug_unicode/buildlog.htm"
Playdvd-2 errors and warnings
=========== All regenerate: 0 succeeded, 1 failed, 0 skipped ========
Compile a DVD
Error:
Playdvd. OBJ: Error lnk2001: the external symbol "unsigned int (_ stdcall * ATL: g_pfngetthreadacp) (void )"(? G_pfngetthreadacp @ ATL @ 3p6gixza)
./Debug/playdvd.exe: Fatal error lnk1120: 1 external command that cannot be parsed
The generated logs are stored in "file: // D:/dxsdk/samples/C ++/DirectShow/DVD/playdvd/debug/buildlog.htm"
Playdvd-2 errors and warnings
============ Generation: 1 succeeded, 1 failed, 0 latest, 0 skipped ==========
Unsolved
Compile editing
Error: xmltltst. cpp
D:/dxsdk/include/uuids. h: Warning c4819: The file contains characters that cannot be expressed in the current Code Page (936. Save the file as Unicode to prevent data loss.
./Xmltltst. cpp (291): Error c2065: "K": Undeclared identifier
./Xmltltst. cpp (304): Error c2065: "J": Undeclared identifier
The generated logs are stored in "file: // D:/dxsdk/samples/C ++/DirectShow/editing/xtltest/debug_unicode/buildlog.htm"
Xtltest-2 errors and warnings
============ Generation: 6 succeeded, 1 failed, 1 latest, 0 skipped ==========
Change: Add unsigned long K = 0;
Unsigned long J = 0;
Compile playwndasf
Error:
Playwndasf. OBJ: Error lnk2001: the external symbol "unsigned int (_ stdcall * ATL: g_pfngetthreadacp) (void )"(? G_pfngetthreadacp @ ATL @ 3p6gixza)
Urllaunch. OBJ: Error lnk2001: the external symbol "unsigned int (_ stdcall * ATL: g_pfngetthreadacp) (void )"(? G_pfngetthreadacp @ ATL @ 3p6gixza)
./Debug_unicode/playwndasf.exe: Fatal error lnk1120: 1 external command that cannot be parsed
The generated logs are stored in "file: // D:/dxsdk/samples/C ++/DirectShow/players/playwndasf/debug_unicode/buildlog.htm"
Playwndasf-3 errors and warnings
========== All regenerate: 1 succeeded, 1 failed, 0 skipped ==========
Change:
Add atlsd. lib to the database dependency
Compile demos (D:/dxsdk/samples/C ++/DEMOS)
Error:
Stdafx. cpp
D:/program files/Microsoft DirectX SDK (release L 2007)/include/d3d9types. H (1385): Warning c4819: The file contains characters that cannot be expressed in the current Code Page (936. Save the file as Unicode to prevent data loss.
D:/dxsdk/samples/C ++/common/include/d3dfile. H (56): Error c2061: syntax error: identifier "lpdirectxfiledata"
D:/dxsdk/samples/C ++/common/include/d3dfile. H (111): Error c2061: syntax error: identifier "lpdirectxfiledata"
D:/dxsdk/samples/C ++/common/include/d3dfile. H (113): Error c2061: syntax error: identifier "lpdirectxfiledata"
The generated logs are stored in "file: // D:/dxsdk/samples/C ++/demos/donuts4/debug/buildlog.htm"
Donuts4-3 errors and warnings
=========== All regenerate: 0 succeeded, 1 failed, 0 skipped ========
Change: Add # include <dxfile. h> to the top of dsdfile. h.
An error occurs during re-Compilation:
../Common/src/d3dfile. cpp (151): Error c2664: "d3dxloadmeshfromxof": the parameter 1 cannot be converted from "lpdirectxfiledata" to "lpd3dxfiledata"
It has nothing to do with the type to be pointed to; conversion requires reinterpret_cast, C style conversion or function style Conversion
Error Source:
If (failed (hR = d3dxloadmeshfromxof (pfiledata, d3dxmesh_systemmem, pd3ddevice,
& Padjacencybuffer, & pmtrlbuffer, null,
& M_dwnummaterials, & m_psysmemmesh )))
Change:
If (failed (hR = d3dxloadmeshfromxof (lpd3dxfiledata) pfiledata, d3dxmesh_systemmem, pd3ddevice,
& Padjacencybuffer, & pmtrlbuffer, null,
& M_dwnummaterials, & m_psysmemmesh )))
Compile d3d
Compile dxtex
Error:
./Dxtexdoc. cpp (694): Error c2440: "initialization": cannot be converted from "const char *" to "tchar *"
Conversion loss qualifier
./Dxtexdoc. cpp (6: Error c2440: "initialization": cannot be converted from "const char *" to "tchar *"
Conversion loss qualifier
Dxtexview. cpp
Winver not defined. Defaulting to 0 × 0502 (Windows Server 2003)
D:/program files/Microsoft DirectX SDK (release L 2007)/include/d3d9types. H (1385): Warning c4819: The file contains characters that cannot be expressed in the current Code Page (936. Save the file as Unicode to prevent data loss.
Mainfrm. cpp
Winver not defined. Defaulting to 0 × 0502 (Windows Server 2003)
D:/program files/Microsoft DirectX SDK (release L 2007)/include/d3d9types. H (1385): Warning c4819: The file contains characters that cannot be expressed in the current Code Page (936. Save the file as Unicode to prevent data loss.
Stdafx. cpp
Winver not defined. Defaulting to 0 × 0502 (Windows Server 2003)
D:/program files/Microsoft DirectX SDK (release L 2007)/include/d3d9types. H (1385): Warning c4819: The file contains characters that cannot be expressed in the current Code Page (936. Save the file as Unicode to prevent data loss.
Generating code...
Creating browsing information file...
Microsoft ?????????? Version 8.00.50727
Copyright (c) Microsoft Corporation. All rights reserved.
The generated logs are stored in "file: // D:/dxsdk/samples/C ++/direct3d/dxtex/debug/buildlog.htm"
Dxtex-2 errors and warnings
============ Generation: 0 succeeded, 1 failed, 0 latest, 0 skipped ==========
Error: tchar * pszleaf = strrchr (lpszpathname ,'//');
Change: tchar * pszleaf = (tchar *) strrchr (lpszpathname ,'//');
An error occurs after compilation:
Linking...
Cvtres: Fatal error cvt1100: duplicate resource. Type: manifest, name: 1, language: 0 × 0409
Link: Fatal error lnk1123: failed during coff conversion: Invalid or corrupt file
Change:
Change compilation in debug mode to release mode.
An error occurred while compiling water (water. cpp:
./Water. cpp (7: Error c2039: "pass": Not a member of "id3dxeffect"
Change: Remove this sentence directly. // m_peffect-> pass (upass)
/Fur. cpp (424): Error c2039: "pass": Not a member of "id3dxeffect"
D:/program files/Microsoft DirectX SDK (rjl 2007)/include/d3dx9effect. H (316): see the "id3dxeffect" statement.
./Fur. cpp (550): Error c2039: "pass": Not a member of "id3dxeffect"
D:/program files/Microsoft DirectX SDK (rjl 2007)/include/d3dx9effect. H (316): see the "id3dxeffect" statement.
./Fur. cpp (567): Error c2039: "pass": Not a member of "id3dxeffect"
D:/program files/Microsoft DirectX SDK (rjl 2007)/include/d3dx9effect. H (316): see the "id3dxeffect" statement.
./Fur. cpp (585): Error c2039: "pass": Not a member of "id3dxeffect"
D:/program files/Microsoft DirectX SDK (rjl 2007)/include/d3dx9effect. H (316): see the "id3dxeffect" statement.
Dxutil. cpp
Change: Change pass to lower-case pass. Compilation in water is also incorrect !!!
Compile vertexblend (vertexblend. cpp)
Error:/vertexblend. cpp (312): Error c2065: "I": Undeclared identifier
./Vertexblend. cpp (315): Error c2228: The left side of ". V" must have a class/structure/Union.
./Vertexblend. cpp (315): Error c2228: The left side of ". X" must have a class/structure/Union.
./Vertexblend. cpp (316): Error c2228: The left side of ". Blend" must have a class/structure/Union.
Correct: For (INT I = 0; I <dwnumvertices; I ++)
{
// Set the blend factors for the vertices
Float a = (pvertices [I]. V. X-fminx)/(fmaxx-fminx );
Pvertices [I]. Blend = 1.0f-sinf (A * d3dx_pi * 1.0f );
} // Int
Question 2
C:/program files/dxsdk/extras/DirectShow/samples/C ++/DirectShow/baseclasses/ctlutil. H (278): Error c4430: Missing type specifier-assumed to be Int. Note: C ++ does not support default int
Coareftime (long );
Operator = (long );
Solution: change
Coareftime (long );
Int operator = (long );
ActiveX DirectShow Solution
The following compilation problems:
Strmbasd. Lib (dllentry. OBJ): Error lnk2001: unresolved external symbol "class cfactorytemplate * g_templates "(? G_templates @ 3pavcfactorytemplate @)
Strmbasd. Lib (dllentry. OBJ): Error lnk2001: unresolved external symbol "int g_ctemplates "(? G_ctemplates @ 3ha)
Solution:
Add the following code to xxxctrl. h:
//////////////////////////////////////// /////////////////////////////////////
// Dllgetclassobject
Extern "C"
Stdapi dllgetclassobject (refclsid rclsid, refiid riid, lpvoid * bp)
{
Afx_manage_state (afxgetstaticmodulestate ());
Return afxdllgetclassobject (rclsid, riid, GMM );
}
//////////////////////////////////////// /////////////////////////////////////
// Dllcanunloadnow
Extern "C"
Stdapi dllcanunloadnow (void)
{
Afx_manage_state (afxgetstaticmodulestate ());
Return afxdllcanunloadnow ();
}
////////////////////////////////////////