NobleUplift
NobleUplift

Reputation: 6024

How do I stop an IntelliSense PCH Warning?

A few of my header files have no includes, so I receive this message in Visual Studio 2010:

IntelliSense: PCH warning: cannot find a suitable header stop location.  An intellisense PCH file was not generated.

If I add a single header, for instance:

#include <iostream>

It disappears. How can I stop this error from showing without adding (potentially unused) include>

Upvotes: 27

Views: 47411

Answers (5)

Visual Micro
Visual Micro

Reputation: 1561

Closing the solution and deleting the .vs folder below the solution folder can often fix the problem. The .vs folder contains the intellisense database for the solution. Vs will be rebuild it the next time the solution is opened.

Upvotes: 0

Lio Ak
Lio Ak

Reputation: 61

Restart Visual Studio (close all active projects).

Nothing helped me except this

Upvotes: 2

Natasha
Natasha

Reputation: 6893

Go to project's property and under C/C++ => Precompiled Headers, find the option "Precompiled header".

Change it to "Not Using Precompiled Headers".

enter image description here

Upvotes: 4

Serid
Serid

Reputation: 361

I suppose the problem is that you have precompiled header in your project (by default "stdafx.h") and to correctly solve the problem you should add

#include "stdafx.h"

at start of your header/source file.

Upvotes: 6

tatigo
tatigo

Reputation: 2264

When adding a .cpp file it inherits the PCH settings of the project. More detailed explanation of the problem here

Solutions:

  1. Add #pragma once at the start of the file.

It will cause your source file to be included only once in a single compilation, therefore the compiler will be satisfied and won't require additional #include

  1. Setting your project to not use precompiled headers
  2. Disable PCH usage for that one cpp file you've added, which will clear both IntelliSense and compiler warning/error.

Note! I'm including num 2, and 3 because some say it helped, but it only num 1 that did solve my case.

Upvotes: 25

Related Questions