views:

132

answers:

2

I have a (com) c++ project, which uses a (.net) c++ dll. The project was compiling and running ok.

Now, all I did was make changes to the dll, and I'm getting a fatal error c1083- cannot open include file stdafx.h - when recompiling my (com) project.

What can this mean?

+1  A: 

Look for your stdafx.h. Here are the possibilities:

  1. If it isn't missing, try restarting you machine. You could also use sysinternals' handle.exe to find out who's holding that file.
  2. If it is missing, create it.
  3. On the other hand, it may be possible that your project did not originally use pre-compiled headers and the option was turned on in error. So, switch off the pre-compiled header option in project properties.
Vulcan Eager
A: 

If your include statement uses angle brackets:

#include <stdafx.h>

...try changing it to use quotes instead:

#include "stdafx.h"

The two are different. When you use quotes you tell the compiler "ok first search the local directory, then go to the search path." But when you use angle brackets you tell the compiler "DONT look in the local directory, just search the search path." In the case of stdafx.h you want the one that is part of the project, so you want to search the local directory first.

Which brings me to a pet peeve of mine, but that's a story for another show...

John Dibling