Scenario
If have the following directory structure within my VS Project.
project/
|
|-- include/
| |
| pch.h
|
|-- src/
| |
| pch.cpp
|
Project.cpp
And my files read like this:
Project.cpp
#include "include/pch.h"
int main()
{
std::cout << "Hello World!\n";
}
pch.h
#ifndef _PCH_H
#define _PCH_H
// IO Libraries
#include <iostream>
#include <iomanip>
#include <io.h>
#include <ostream>
#include <conio.h>
... more headers
#endif // !_PCH_H
pch.cpp
#include "../include/pch.h"
Now, the properties for each element are configured for Precompiled Headers as follows:
Project
Precompiled Header Use(/Yu)
Precompiled Header File pch.h
Precompiled Header Output File $(IntDir)$(TargetName).pch
pch.cpp
Precompiled Header Create(/Yc)
Precompiled Header File pch.h
Precompiled Header Output File $(IntDir)$(TargetName).pch
Problem
When I attempt to compile this project, I receive the following error:
Severity Code Description
-------------------------------------------------------------------------------------------------------
Error C2857 '#include' statement specified with the /Ycpch.h command-line option was not found in the source file
Project File Line
-------------------------------------------------------------------------------------------------------
C:\Workspace\VisualStudio\C++\Poker\Poker\src\pch.cpp 2