Platform SDK samples

I just installed Express C++ and thought I would start by compiling a Directshow sample. I had all kinds of problems when I found out there are newer versions of the samples in the Platform SDK. The new samples have been converted to nmake builds with no VC project files. Is there an easy way to make a project I tried the new->makefile template, but that did not copy any source files.

Anyone able to build Platgorm SDK samples



Answer this question

Platform SDK samples

  • Zhi-Xin Ye - MSFT

    Moving thread to C++,

    If you are still having problems you might also want to look at the dshow forums.



  • Dr. WU

    It is possible to compile PSDK samples using nmake from the command line after installing the Platform SDK. There are a few undocumented steps required to do this.

    You can also use a generic project that allows for make files. This option is supported on the Express Edition File | New | Project ... dialog with General project type and Makefile Project template.

    1. The key to either method is to copy the directory containing the sample files to a project directory somewhere. (The makefiles are designed to work in the same directory that has the project.)

    2. You should use the same directory name. For example, I put the PSDK "Generic" sample into a directory, C:\MyProjects\Generic, just to avoid possible difficulties. (The makefiles tend to force the PROJECT parameter.)

    3. To build the sample from the command-line, you will need to have the PATH, INCLUDE, and LIB environment variables have the additions required for VC++ Express edition and the Platform SDK, both. (The Platform SDK locations should be first in the search paths.)

    4. Having done that, the "Generic" sample builds perfectly from the Generic directory with the command lines

    • nmake OUTDIR=Debug
    • nmake OUTDIR=Release NODEBUG=1

    one for debug, one for release.

    If you have other environment variables all set properly, you should get clean clean compiles and a program, Generic.exe in the OUTDIR subdirectory of Generic.

    5. This uses the same directory structure that Visual C++ 2005 Express Edition will also use. So once you have confirmed a command-line build, you can do it with a Generic VC++ Project too.

    6. Make a Generic Makefile Project project (without a solution directory). Name the project Generic and point Visual C++ to the directory above where you made a Generic directory (or where you want one, if you want to start from scratch).

    When the wizard comes up, use

    "nmake OUTDIR=$(ConfigurationName)"

    for the Debug Configuration Build Command Line.

    Use "nmake OUTDIR=$(ConfigurationName) clean" for the Clean commands

    and "nmake OUTDIR=$(ConfigurationName) all" for the Rebuild All commands.

    Change the Output to

    "$(ConfigurationName)\Generic.exe

    The Release Configuration is the same as Debug except the additional parameter

    "NODEBUG=1"

    is added for the Release Configuration Build and Rebuild All commands.

    7. Copy all of the sample material into the project directory, if you are not using a directory that already has the files. (Please do not get in the habit of using the Samples directly from the PSDK directories under Program Files. Leave those "pure" and do all work with copies.)

    8. Even though it looks like your project is empty, building (F7) and execution (Ctrl+F5) should work just fine. If Ctrl+F5 says the project is out-of-date, just let it rebuild the solution. It should then work fine.

    9. To work with the source files, just Add them with Project | Add Existing Item ... so they show up in VC++. You can now open those and, for debugging, you can now set breakpoints and so on. All of the building will be done with the nmake and the configuration settings that you've already made. It doesn't require that VC++ actually know what the files are, since nmake is controlling all of that. If you modify any of the files, both VC++ and nmake will do the right thing in rebuilding only those files that depend on the changes.

    This is a hasty run-through, but I know people are looking for worked cases that demonstrate some use of the PSDK samples.



  • Joe Kelly

    Danke. Yes, they are intended to be run with nmake. I get that part. I am coming back to C after many many years. I thought I rememberd a tool that analyzed makefiles and made a project. Maybe it was the other way around. I want to use the IDE eventually to modify the sample. Also, nmake doesn't work for my sample(AMcap)and needs to be edited/debugged.
  • JeremyKei

    AFAIK nmake is part of the installation.

    Start a command line and run name from the command line. The samples are not intendet to be build from within an IDE.



  • mashee007

    I am not sure if this is possible with the Express version.

    With Standard and higer you can create a new Project under the section VC++ General. There is a so called "Makefile Project" with this you can define the projects makefile and buildand edit from within the IDE.

    HTH



  • Platform SDK samples