C++ / Documentation search
Find the error. Find the next step.
Search by diagnostic code, copied message, or symptom. Filter by content and project system.
176 results
Browse documentation →C1004: A macro hides a brace.
A macro that opens a block, such as BEGIN_MESSAGE_MAP , needs its closing macro.
C1004: An included header leaves a block open.
A header that ends inside a namespace or an extern "C" { moves the error to the file that includes it: check the headers included last.
C1010: The file does not include the precompiled header.
Add #include "pch.h" , or stdafx.h in older projects, as the first line of the file.
C1010: The file should not use it.
For C files and third-party sources, set C/C++ > Precompiled Headers > Precompiled Header to Not Using Precompiled Headers in that file's properties.
C1010: The name does not match the setting.
The include must name the file set in Precompiled Header File , exactly.
C1083: A dependency or an SDK is not installed.
For Windows or standard headers, install the Windows SDK or the C++ workload in the Visual Studio Installer; for a library, restore it, for example with vcpkg.
C1083: It is set for another configuration or platform.
Settings made for Debug or Win32 only do not apply to Release or x64: select All Configurations and All Platforms when you add the directory.
C1083: Its folder is not an include directory.
Add it to C/C++ > General > Additional Include Directories , relative to the project with $(ProjectDir) or $(SolutionDir) rather than as an absolute path.
C1083: Quotes and angle brackets search differently.
#include "file.h" looks first next to the including file; <file.h> only in the include directories.
C1083: The path in the directive is wrong.
Check the folder names in #include "lib/file.h" against the directory you added.
C2001: A path ends with a backslash.
In "C:\Data\" , \" is an escaped quote. Double the backslashes, or write a raw string: R"(C:\Data\)" .
C2001: The closing quote is missing.
Close the string on the same line. To continue a long string, close it and open another one on the next line: adjacent literals are joined.
C2001: The file is UTF-8 and contains non-ASCII characters.
Without a BOM, MSVC reads the file in the system code page, and on Chinese, Japanese, or Korean Windows a multi-byte character can absorb the closing quote. Add /utf-8 to C/C++ > Command Line > Additional Options , or save the file as UTF-8…
C2011: windows.h is included before winsock2.h .
windows.h includes the old winsock.h , which redefines sockaddr : include winsock2.h first, or define WIN32_LEAN_AND_MEAN before windows.h .
C2011: A header has no include guard.
Add #pragma once at the top of the header, so that including it twice defines its types once.
C2011: Two headers define the same type.
Keep one definition, in one header, and include it from the other.
C2027: A std::unique_ptr member points to an incomplete type.
With the pimpl idiom, the destructor must be defined where the type is complete: declare ~Owner(); in the header and define Owner::~Owner() = default; in the .cpp file, after the include.
C2027: A class contains an object of its own type.
A class cannot contain itself by value: use a pointer or a container such as std::vector .
C2027: The code uses a member of a forward-declared class.
Include the header that defines the class in the .cpp file that calls its members, creates it, or copies it.
C2027: Two headers include each other.
Keep the forward declaration in one header, move the code that uses the members to the .cpp file, and include the full header there.