Notes on software development (Windows) and computer system administration.

2005-11-28

Visual C++ Project continually out-of-date (winwlm.h macwin32.h rpcerr.h macname1.h missing)

Problem:
In Visual C++ .Net 2003, one of my projects always claimed to be out of date, even though nothing had changed and no errors had been reported in the last build.

Opening the BuildLog.htm file for the corresponding project showed a list of PRJ0041 errors for these files, none of which appear on my system anywhere:
winwlm.h macwin32.h rpcerr.h macname1.h

Each error looks something lik ethis:
MyApplication : warning PRJ0041 : Cannot find missing dependency 'macwin32.h' for file 'MyApplication.rc'. Your project may still build, but may continue to appear out of date until this file is found.

Solution:
Include afxres.h instead of resource.h inside the project's .rc file.

The project's .rc file contained "#include resource.h". Since the resource compiler does not honor preprocessor #ifdef blocks, it will tear through and try to find include files it should be ignoring. Windows.h contains many such blocks. Including afxres.h instead fixed the PRJ0041 warnings and eliminated the "Project is out-of-date" error dialog.

No comments: