question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IntelliSense complains about standard types when using precompiled headers

See original GitHub issue

Brief Issue Summary

IntelliSense starts to complain about all standard things when I’m using target_precompile_headers(), e.g. std::size_t: "namespace "std" has no member "size_t"". The project itself builds just fine. Code structure:

//./project/src/common.h
#include <vector>
//etc.

//./project/src/main.cpp
#include "common.h"
//use std::vector...

CMake structure:

# ./project/CMakeLists.txt:
# some global settings like project(), etc.
add_subdirectory(src)

# ./project/src/CMakeLists.txt
add_executable(project)
target_sources(project
	PRIVATE
	main.cpp
	common.h)
target_precompile_headers(project
	PRIVATE
	"common.h"
)

Without target_precompile_headers() everything is OK.

Platform and Versions

  • Operating System: Ubuntu 18.04
  • CMake Version: 3.16
  • VSCode Version: 1.43.2
  • CMake Tools Extension Version: 1.3.1
  • Compiler/Toolchain: GCC 9.2.1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
andreeiscommented, Apr 1, 2020

I reproduce now, thanks for the small project.

0reactions
bobbrowcommented, Oct 31, 2022

I believe it was fixed in 1.11.25 with this PR where we started forwarding the compiler options to cpptools for parsing instead of doing it ourselves: https://github.com/microsoft/vscode-cmake-tools/pull/2563

Read more comments on GitHub >

github_iconTop Results From Across the Web

intellisense errors when using visual studio force include
I am experiencing an issue when I attempt to use the visual studio option force include (/FI) with a precompiled header file. When...
Read more >
Known issues with IntelliSense for C++20 modules
IntelliSense not working in some files when using C++20 modules. Intellisense is extremely slow with c++20 modules and large precompiled headers.
Read more >
Did you abandon headers for modules? Why/Why not? : r/cpp
MSVC supports them, but intellisense does not fully support them. So if you use Visual Studio (which is common if you use MSVC)...
Read more >
Healthy Lifestyle Score items - Menzies Institute for Medical ...
IntelliSense complains about standard types when using precompiled headers bug Feature: cpptools integration more info needed. #1141 opened Mar 25, ...
Read more >
Intellisense stops working when forced include multiple headers
When I forced include a precompiled header on a source file followed by a few other stable headers that don't need to be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found