Trying to get metainfo sample application to compile

I am currently trying to get the metainfo sample application that comes with VS 2003. The application code is located at (for a standard VS.Net install):
C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Tool Developers Guide\Samples\metainfo

Since I am learning VC++ and the ins and outs of the VC++ IDE in VS.Net (tons of settings I haven't a clue about yet) ... I just can't the application to compile. Currently I am getting 3 errors, all C2664 'cannot convert parametern fromtype totype. For example:

metainfo.cpp(147): error C2664: 'FindFirstFileW' : cannot convert parameter 2 from 'WIN32_FIND_DATA *__w64 ' to 'LPWIN32_FIND_DATAW'

I started doing a little digging as to what this error message is about ... then I remember that this is sample code ... so it probably works fine. Or it would if I knew the correct settings to set it up in VS.Net ... or so I am thinking. Here is what I have done:

1. Created a Win32 Console application
2. Removed all the .cpp files and .h files that came with that Console application
3. Added all the .cpp files in the metainfo directory mentioned above to the Source Files
4. Added all the .h files in the metainfo directory mentioned above to the Header Files
5. Try and build ...

Anyone out there have an idea of what I am missing?

Thanks for any help

[1386 byte] By [JasonHaley] at [2008-2-21]
# 1
The console project you created does miss all the preprocessor defines. You can look them up in the metainfo.mak. There you'll see a _MACROS variable with all the /D options.

To add those defines to your VS.NET project:
open up the project properties of your console project. Choose "All configurations". Choose "C/C++ - Preprocessor". Paste this into the "Preprocessor Defintions:"

_WIN32, _WIN32_DCOM, WIN32_LEAN_AND_MEAN, JIT_OR_NATIVE_SUPPORTED, _META_DATA_SCOPE_WRAPPER, UNICODE, _UNICODE

You should add _DEBUG to debug configuration

There are still some warnings because of some "32-bit CPU assumptions" regarding pointer length. You can ignore them as long as you are running the sample on 32-bit Windows.

HTH,
SvenC

SvenC at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 2
Thank You! Works great now.
JasonHaley at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 3
Hi Jason,

please answer the question if the answer was helpful which you'll find beneath every subject of an answer. This will help to quickly see if a question has been answered when looking at the list of questions - it triggers the change of a red question mark to the green answered icon.

Bye,
SvenC

SvenC at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...