I downloaded the PhotoView reference app for Win7 with source. The app works, but I can’t get the project to build.
There is a ServiceControlInterop C++ project in the solution that won’t build. I figured out that it needed the Win7 SDK, which I downloaded, but now that I’ve got the proper winsvc.h referenced I get a slew of new errors. I’m far from an adept C++ developer, so I’m hoping this list will call out something obvious to some C++ guru:
UPDATE: anelson was exactly correct, adding those paths allowed me to compile the ServiceControlInterop project.
For those interested, you’ll also need the UACHelpers project and the Microsoft.KtmIntegration class to get the whole solution to compile, it’s quite a beast. Add the UACHelpers project to the solution and create a new project for the Microsoft.KtmIntegration class (the link is to a code listing on MSDN… I think it must be a supporting class they forgot to include with the PhotoView source.)
Error 13 error C2065: 'NETWORK_MANAGER_FIRST_IP_ADDRESS_ARRIVAL_GUID' : undeclared identifier C:\Program Files\Microsoft SDKs\Windows\v7.0\include\Winsvc.h 313 ServiceControlInterop (Windows7Plugins\TrigerStartService\ServiceControlInterop)
Error 14 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files\Microsoft SDKs\Windows\v7.0\include\Winsvc.h 318 ServiceControlInterop (Windows7Plugins\TrigerStartService\ServiceControlInterop)
Error 15 error C2078: too many initializers C:\Program Files\Microsoft SDKs\Windows\v7.0\include\Winsvc.h 318 ServiceControlInterop (Windows7Plugins\TrigerStartService\ServiceControlInterop)
Error 16 error C2065: 'NETWORK_MANAGER_LAST_IP_ADDRESS_REMOVAL_GUID' : undeclared identifier C:\Program Files\Microsoft SDKs\Windows\v7.0\include\Winsvc.h 321 ServiceControlInterop (Windows7Plugins\TrigerStartService\ServiceControlInterop)
Error 17 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files\Microsoft SDKs\Windows\v7.0\include\Winsvc.h 326 ServiceControlInterop (
I assume you mean this sample. You definitely need the Windows 7 SDK as you’ve already figured out. But you need to have your include and lib paths set up to point to the Windows 7 SDK as well.
In Visual Studio 2k8, go to Tools | Options, and in the tree click Projects and Solutions | VC++ Directories.
Your include directories for both architectures should be:
(source: flickr.com)
Your library directories should be:
(source: flickr.com)
(NB: This is for x64. For x86 drop the ‘x64’ from the end of the path
UPDATE: Forgot to mention you may need to do a Rebuild of the project after you change the include path, if the precompiled headers were already generated with the missing header files.