TechIt · Windows

Building direct show filters in Visual Studio 2008

First off, make sure you have the latest windows sdk.

The direct show base classes are in there now and not directx sdk.

There are required headers in direct show base classes in the samples directory of the sdk.

Thus, you need to reference the header files in

C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses

You will also to build that solution and link the lib file:

  1. Drop down the Tools menu, and select Options [ from http://www.lavishsoft.com/wiki/index.php/Visual_Studio_Paths ]
  2. In the box on the left is a list of option categories. Select “Projects and Solutions” and then the sub-category “VC++ Directories”
  3. In the upper right hand corner is a drop-down box that selects a particular set of default directories, including “Executable files”, “Include files”, “Reference files”, “Library files”, and “Source files”. Generally, you only want to add to the “Include files” or “Library files” lists. Select “Include files”
  4. In the middle of the right hand side of the window is a list of directories.
    1. Add the include path by pressing the “New Line” button above the window, or by pressing “Ctrl-Insert” or clicking under the last entry.
    2. A blank entry appears for you to either type the path or navigate by clicking the “…” button.
    3. Generally the final path you want will end with a folder called “include”. Enter the path now (e.g., c:\program files\isxdk\include)
      1. For direct show base classes, enter C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses
  5. Select “Library files” in the drop-down box
  6. In the same fashion as done for the include file path, add the path to the library files. (e.g., c:\program files\isxdk\lib\vs80)
    1. Add the direct show path C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses\release_mbcs
  7. You’re done, click OK

These includes need to be before the windows sdk includes, or you will have issues with definitions in refclock.h as there is another header of this name in the sdk.

I ran into this too. I found that you need to have the baseclasses directory (samples/multimedia/directshow) *before* the sdk include directory, since they both have a schedule.h file and refclock.h uses <> not ” for the include. I was slightly surprised to see that no-one else had mentioned this. [ http://social.msdn.microsoft.com/Forums/en/windowsdirectshowdevelopment/thread/5da8f0b8-d2a9-4caf-81e1-7f5788fa1c00 ]

The exact error reads as follows:

WIN32

c1xx : fatal error C1083: Cannot open source file: ‘WIN32’: No such file or directory

 

After I get this error once, I can recompile again, and since the changed file has now been compiled, it goes directly to linking and doesn’t spit this error out again.

I also found reference to other potential causes for this error online:

  • Make sure the compiler sees /D “WIN32”, without /D it will try to compile WIN32. Project + properties, C/C++, Command line.
  • /I “” is your problem, it swallows the next /D. I tried it and got the same error message. Not sure how you got it, there’s probably something wrong with Project + properties, C/C++, Additional include directories.
  • I’d added an environment variable which had now been removed, thus creating an empty /I “”.

And that’s about all I took note of.

Leave a comment