Reputation: 7004
I've been handed the source code for a very large c++ project and asked to make a small change to support some new hardware. I'm not very familiar with c++, as I mostly use C# these days.
When I built the project I'm getting 20+
Error 2 error C1083: Cannot open include file: 'StdAfx.h': No such file or directory D:.. thefile.cpp
From my understanding the "StdAfx.h" is to do with precompiled headers, and is automatically generated?
I followed the answer on this question:
1 Ensure you have the file "stdafx.h" in your project. If you don't (e.g. you removed it) just create a new temporary project and copy the default one from there;
but in doing so noticed that the created stdafx.h file doesn't have the capitalisation of the referenced "StdAfx.h"
I managed to get rid of a single error by copying in the generated file from a new project and changing:
#include "StdAfx.h"
to:
#include "stdafx.h"
I can't help but think this project was using StdAfx.h (there are about 150 references to it) for a reason, and that I shouldn't be adding a bunch of stdafx.h and stdafx.cpp files scattered around the place.
Is there some way of referencing a global stdafx.h file that was being used that could be causing this error?
Upvotes: 0
Views: 544
Reputation: 11311
Upvotes: 0