DX player compilation problems

Source: Internet
Author: User

I am also a beginner. If any of the following articles is incorrect, please leave a message. Thank you!

[1] Make sure that your host has installed the VS 2005 and DirectX 9.0b sdks. The dx9.0 SDK will not be written. Find it online! (My dx9.0 is installed in the root directory of the D Drive)

[2] compile baseclasses. sln under the samplesc ++ directshowbaseclasses directory to get two library files (strbase. lib and strmbase. Lib ). The following describes how to modify compilation errors, which are not described in many articles. I wrote it by myself. Sorry!

Go to the DirectShow installation directory, find samplesc ++ directshowbaseclasses, and double-click baseclasses. sln to open the solution. First, you will see the conversion Wizard of Visual Studio. You don't need to worry about it, just click Next to finish.

Click F5 to debug and run it. You will see the following errors (at least this is the result when I compile it ):

1> ------ build started: Project: baseclasses, configuration: Debug Unicode Win32 ------
1> compiling...
1> dllentry. cpp
1> D: Program filesmicrosoft Visual Studio 8vcplatformsdkincludewinnt. H (222): Error c2146: syntax error: Missing '; 'before identifier' pvoid64'
1> D: Program filesmicrosoft Visual Studio 8vcplatformsdkincludewinnt. H (222): Error c4430: Missing type specifier-int assumed. Note: C ++ does not support default-int
1> D: Program filesmicrosoft Visual Studio 8vcplatformsdkincludewinnt. H (5940): Error c2146: syntax error: Missing '; 'before identifier 'buffer'
1> D: Program filesmicrosoft Visual Studio 8vcplatformsdkincludewinnt. H (5940): Error c4430: Missing type specifier-int assumed. Note: C ++ does not support default-int
1> D: Program filesmicrosoft Visual Studio 8vcplatformsdkincludewinnt. H (5940): Error c4430: Missing type specifier-int assumed. Note: C ++ does not support default-int
1> D: dxsdksamplesc ++ directshowbaseclassesctlutil. H (278): Error c4430: Missing type specifier-int assumed. Note: C ++ does not support default-int
1> D: dxsdkincludeuuids. h: Warning c4819: The file contains a character that cannot be represented in the current Code Page (936). Save the file in unicode format to prevent data loss
1> build log was saved at "file: // D: dxsdksamplesc1_directshowbaseclassesdebug_unicodebuildlog.htm"
1> baseclasses-6 error (s), 1 warning (s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========

No way. correct the error. (I have mentioned this in my online article, but I don't understand what it means !)

Double-click 1> D: Program filesmicrosoft Visual Studio 8vcplatformsdkincludewinnt. H (222): Error c2146: syntax error: Missing '; 'before identifier' pvoid64' to jump to the error location.

You will see the error statement: typedef void * pointer_64 pvoid64;

This definition is not supported in vs2005. Modify it to two statements:

# Define pointer_64 _ ptr64

Typedef void * pvoid;
Typedef void * pointer_64 pvoid64;

After debugging and running, one more error is found:

1> ------ build started: Project: baseclasses, configuration: Debug Unicode Win32 ------
1> compiling...
1> dllentry. cpp
1> D: dxsdksamplesc ++ directshowbaseclassesctlutil. H (278): Error c4430: Missing type specifier-int assumed. Note: C ++ does not support default-int
1> D: dxsdkincludeuuids. h: Warning c4819: The file contains a character that cannot be represented in the current Code Page (936). Save the file in unicode format to prevent data loss
1> build log was saved at "file: // D: dxsdksamplesc1_directshowbaseclassesdebug_unicodebuildlog.htm"
1> baseclasses-1 error (s), 1 warning (s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========

Only change it! Double-click 1> D: dxsdksamplesc ++ directshowbaseclassesctlutil. H (278): Error c4430: Missing type specifier-int assumed. note: C ++ does not support default-int jump to the error location.

You will see the error statement operator = (long );

There is no returned value! Just add one to it and change it to: long operate = (long );

Debug and run again, wow! More errors:

1> ------ build started: Project: baseclasses, configuration: Debug Unicode Win32 ------
1> compiling...
1> wxdebug. cpp
1>. wxdebug. cpp (534): Warning c4996: '_ vsnwprintf' was declared deprecated
1> D: Program filesmicrosoft Visual Studio 8vcincludestdio. H (450): See Declaration of '_ vsnwprintf'
1> message: 'This function or variable may be unsafe. consider using _ vsnwprintf_s instead. to disable deprecation, use _ crt_secure_no_deprecate. see _ disibledevent = "file: // D: dxsdksamplesc1_directshowbaseclassesdebug_unicodebuildlog.htm"> file: // D: Example"
1> baseclasses-10 error (s), 2 warning (s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========

If something is wrong, change it!Double-click 1>. wxdebug. cpp (567): Error c4430: Missing type specifier-int assumed. Note: C ++ does not support default-int to the error location.

You will see the error statement: static g_dwlastrefresh = 0;

Is there such a definition for static type variables? You have to give a type! Change it to: static DWORD g_dwlastrefresh = 0; why is the type specified as DWORD? Check the statements in the program to understand-ensure that the same type of variables are computed.

Debug and run again:

1> ------ build started: Project: baseclasses, configuration: Debug Unicode Win32 ------
1> compiling...
1> winutil. cpp
1>. winutil. cpp (2104): Error c2065: 'Count': Undeclared identifier
1>. winutil. cpp (2106): Error c2228: Left of '. pered' must have class/struct/Union
1>. winutil. cpp (2106): Error c2228: Left of '. pered' must have class/struct/Union
1>. winutil. cpp (2107): Error c2228: Left of '. pegreen' must have class/struct/Union
1>. winutil. cpp (2107): Error c2228: Left of '. pegreen' must have class/struct/Union
1>. winutil. cpp (2108): Error c2228: Left of '. peblu' must have class/struct/Union
1>. winutil. cpp (2108): Error c2228: Left of '. peblu' must have class/struct/Union
1>. winutil. cpp (2124): Error c2228: Left of '. peflags' must have class/struct/Union
1> outputq. cpp
1>. outputq. cpp (664): Error c2065: 'idone': Undeclared identifier
1> generating code...
1> build log was saved at "file: // D: dxsdksamplesc1_directshowbaseclassesdebug_unicodebuildlog.htm"
1> baseclasses-9 error (s), 0 warning (s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========

An error is missing! Continue to work! Double-click 1>. winutil. cpp (2104): Error c2065: 'Count': Undeclared identifier to the error location.

You will see the error statement: For (COUNT = 0; count <result; count ++ ){

Count is not defined? See the preceding statements of this statement:

For (uint COUNT = 0; count <result; count ++ ){
If (systementries [count]. pered! = Pentry [count]. pered |
Systementries [count]. pegreen! = Pentry [count]. pegreen |
Systementries [count]. peblue! = Pentry [count]. peblue ){
Bidentitypalette = false;
}
}

// And likewise compare against the last ten entries

Result = getsystempaletteentries (HDC, palhistart, pallocount, systementries );

See it! Count is a variable defined in the loop body. After a loop is generated, "life" is over. So define it to the outside. Change the preceding statement:

Uint COUNT = 0;

For (COUNT = 0; count <result; count ++ ){
If (systementries [count]. pered! = Pentry [count]. pered |
Systementries [count]. pegreen! = Pentry [count]. pegreen |
Systementries [count]. peblue! = Pentry [count]. peblue ){
Bidentitypalette = false;
}
}

// And likewise compare against the last ten entries

Result = getsystempaletteentries (HDC, palhistart, pallocount, systementries );

Debug and run again:

1> ------ build started: Project: baseclasses, configuration: Debug Unicode Win32 ------
1> compiling...
1> winutil. cpp
1> outputq. cpp
1>. outputq. cpp (664): Error c2065: 'idone': Undeclared identifier
1> generating code...
1> build log was saved at "file: // D: dxsdksamplesc1_directshowbaseclassesdebug_unicodebuildlog.htm"
1> baseclasses-1 error (s), 0 warning (s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========

Good! There is one error left! Change again,Double-click "1">. outputq. cpp (664): Error c2065: 'idone': Undeclared identifier
Jump to the error location.

You will see the error statement: * nsamplesprocessed = idone-ilost;

Idone is not defined? OK. Continue to read the preceding statements:

// Loop processing the samples in batches

Long ilost = 0;
For (long idone = 0;
Idone <nsamples | (m_nbatched! = 0 & m_bsendanyway );
){

//...

Similarly, place the idone definition outside the loop body and change it:

// Loop processing the samples in batches

Long ilost = 0;

Long idone = 0;
For (idone = 0;
Idone <nsamples | (m_nbatched! = 0 & m_bsendanyway );
){

//...

After the modification is complete, debug and run again:

1> ------ build started: Project: baseclasses, configuration: Debug Unicode Win32 ------
1> compiling...
1> outputq. cpp
1> creating library...
1> build log was saved at "file: // D: dxsdksamplesc1_directshowbaseclassesdebug_unicodebuildlog.htm"
1> baseclasses-0 error (s), 0 warning (s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========

I finally met succeeded! Are you calling it out?

Next, generate the required database files as follows:

Click build> batch build> in the menu bar of vs2005. In the displayed batch build dialog box, click Select All. Click build. Generate the two library files required for programming: strbase. lib and strmbase. Lib.

[3] configure the include and Lib directories of DirectX SDK to the system directory of vs2005 and put them in the standard vs2005 directory. The procedure is as follows:

Click option on the menu bar of vs2005 --> click the plus sign before projects and solutions in the displayed option dialog box. --> click VC ++ directories -->

(1) Select include files from the show directories for drop-down list and add the following paths:

D: dxsdkinclude

D: dxsdksamplesc ++ directshowbaseclasses

D: dxsdksamplesc ++ commoninclude

(2) Select library files from the show directories for drop-down list and add the following paths:

D: dxsdklib

D: dxsdksamplesc ++ directshowbaseclassesdebug

D: dxsdksamplesc ++ directshowbaseclassesdebug_unicode

D: dxsdksamplesc ++ directshowbaseclassesrelease

D: dxsdksamplesc ++ directshowbaseclassesrelease_unicode

After adding the path, don't forget to click OK!

[4] This step briefly introduces what library files need to be appended during programming and how to add them.

The DirectShow application should at least connect to the library files strmiids. lib and quartz. Lib. The former defines the standard CLSID and IID of DirectShow, and the latter defines the export function amgeterrortext (if this function is not used in the application, you can also not connect to this library ).

If the program contains the header file streams. H, the general library file also needs to connect strmbasd. Lib, UUID. Lib, winmm. Lib.

If you do not know how to append a library file, try the following steps:

(1) You must first create or open a solution.

(2) Click project --> XXX properties --> in the menu bar of vs2005 to bring up the property Setting dialog box, expand configuration properties --> Expand linker --> click input --> Add a library in addtional dependencies on the right. Separate each library file with spaces.

Example: strbase. Lib strmiids. Lib

[5] after all the work is done, you can write and debug the program with confidence. Come on!

The first article in the blog is helpful to beginners! Make progress together!

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.