DirectShow 1 -- download and VC Configuration

Source: Internet
Author: User
Tags microsoft c

DirectShow SDK download URL:
Http://download.microsoft.com/download/d/9/1/d91c44b9-fbac-4e8e-bee1-4a75777923ec/dxsdk_feb2005_extras.exe

When running the DirectShow example, you must first set the Visual C ++ environment to edit the environment. Otherwise, many errors may occur, such as a connection error or a definition cannot be found. Set the path of the header file referenced by the program, library file, or resource file.


Procedure: choose tools> Options> projects and solutions> VC ++ on the menu bar. Select the executable file and header file in the drop-down box on the right, library file waiting, so that you can set the path of the file where it is located.


The files may be stored in:

1. In the folder where dirctx is installed: Lib and include;

2. Lib, include, samples \ multimedia \ DirectShow \ baseclass, and samples \ multimedia \ DirectShow \ common files in the folder where platform is installed.


How to determine the files required by the project:

Find the compilation error in the SDK and prompt the help of the undefined member to see the header files and library files it requires. You can use # include and # pragma comment to reference them in the code file

# Include <dshow. h>

# Pragma comment (Lib, "ole32.lib ")


For example, there is no VC ++ solution in the example provided by it, and you may encounter many unimaginable problems when creating a new empty solution to add the provided source files, because they use the nmake command to generate projects. During the generation process, their files are compiled in the prefix and prefix order, and some files are too lazy to be generated by the previous compilation. Therefore, it is very complicated to set project properties, if it is not set properly, various compilation errors may easily occur. However, you can go to all the folders of the project in the command line and run the command nmake/N to view the commands run by the generated project. Set the properties of the new project based on the command information. To correctly configure the target attributes, you must understand the nmake, Cl. EXE, Link. EXE, and RC. EXE commands. Some references are provided below.


Nmake Command Option reference

Microsoft program maintenance utility (nmake. EXE) is a 32-bit tool that generates a project based on the commands contained in the description file.
Http://msdn.microsoft.com/library/c...ake_options.asp


Cl.exe option description

Cl.exe is a 32-bit tool that controls Microsoft C and C ++ compilers and connectors. The compiler generates a Common Object File Format (coff) object (. OBJ) file. The linker generates an executable file (.exe) or a dynamic link library file (DLL ).

Http://msdn.microsoft.com/library/c...habetically.asp

For link Command Options, refer:

Link is a 32-bit tool that links common object file formats (coff) object files and libraries to create a 32-bit executable (.exe) file or dynamic link library (DLL ).

Http://msdn.microsoft.com/library/c...r_reference.asp

Relationship Between Cl. EXE and link
Http://msdn.microsoft.com/library/c...ink_options.asp

RC command

Microsoft Windows resource compilation command, no relevant information found, only in the command line in the input RC /? Check the built-in help.


Example of generating DirectShow SDK in command line
Http://www.cnblogs.com/xuanfeng/arc.../04/494236.html

2 DirectX sdk8.1

(Assume that DirectX sdk8.1 is installed in the C: \ dxsdk directory .)

1. Compile the source code of the base class and generate at least two static library files.

Open c: \ dxsdk \ samples \ multimedia \ DirectShow \ baseclasses. DSW, generate strmbasd. Lib in debug, and generate strmbase. Lib in release.


2. Configure the compiling environment of VC: include directory and lib directory. Run the VC menu command tools | OPTIONS ..., In the displayed dialog box, go to the directories page, select include files in the show directories for option, and configure the following: (Note that the DirectX SDK directory must be placed before the standard VC directory .)

C: \ dxsdk \ include

C: \ dxsdk \ samples \ multimedia \ DirectShow \ baseclasses

C: \ dxsdk \ samples \ multimedia \ common \ include

C: \ Program Files \ Microsoft Visual Studio \ vc98 \ include

C: \ Program Files \ Microsoft Visual Studio \ vc98 \ MFC \ include

C: \ Program Files \ Microsoft Visual Studio \ vc98 \ ATL \ include

In the show directories for field, select library files. The configuration is as follows:

C: \ dxsdk \ Lib

C: \ dxsdk \ samples \ multimedia \ DirectShow \ baseclasses \ debug

C: \ dxsdk \ samples \ multimedia \ DirectShow \ baseclasses \ release

C: \ Program Files \ microsoft SDK \ Lib

C: \ Program Files \ Microsoft Visual Studio \ vc98 \ Lib

C: \ Program Files \ Microsoft Visual Studio \ vc98 \ MFC \ Lib


3. Configure the library file to be connected to the DirectShow application development project.

Run the VC menu command project | settings ..., In the displayed dialog box, enter the link page. In the object/library modules field, enter strmbasd for debug. lib msvcrtd. lib winmm. enter the lib and release versions in strmbase. lib msvcrt. lib winmm. lib. Ignore default libraries. (in Microsoft Visual C ++ 6.0, choose settings from the project menu.
Click the link tab and check ignore all default libraries .)


4. If the installed DirectX SDK version is earlier than 9.0, make sure that the debug macro has been defined before the debug version of the application is compiled. Run the VC menu command project | settings ..., In the displayed dialog box, go to the C/C ++ page, select Preprocessor for the category item, and then confirm that the Preprocessor definitions contains debug (if not, add it by yourself ).

In addition, before calling any COM library function, the application must call coinitialize or coinitializeex to initialize the com Library (generally only once when the program starts ); after All com operations are completed, couninitialize is called for anti-initialization (usually called once before the program exits ). When multiple threads in the program use the com library function, each thread must be initialized and reinitialized. In short, make sure that the couninitialize and coinitialize (or coinitializeex) calls one-to-one pairing.

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.