CppPilot

C++ / Documentation search

Find the error. Find the next step.

Search by diagnostic code, copied message, or symptom. Filter by content and project system.

  1. Examples and diagramsMSBuild + CMake

    C2039: The header that declares it is not included.

    std::filesystem needs <filesystem> , std::optional needs <optional> : include the header of what you use.

  2. Examples and diagramsMSBuild + CMake

    C2039: The member belongs to another class.

    Check the expression's static type. A base-class reference does not expose a member declared only by a derived class. Access through a pointer uses -> , but incorrect pointer syntax can produce a different diagnostic.

  3. Examples and diagramsMSBuild + CMake

    C2039: The member name is misspelled.

    Check the spelling and the case, for example push_back .

  4. Examples and diagramsMSBuild + CMake

    C2039: The member needs a newer C++ standard.

    std::filesystem needs C++17, starts_with C++20: set C/C++ > Language > C++ Language Standard .

  5. Examples and diagramsMSBuild + CMake

    C2061: A dependent type in a template has no typename .

    Write typename T::value_type : inside a template, a name that depends on a template parameter is not a type unless you say so.

  6. Examples and diagramsMSBuild + CMake

    C2061: The type is not declared at that point.

    Include its header before the declaration, or qualify it with its namespace, for example std::string .

  7. Examples and diagramsMSBuild + CMake

    C2061: Two headers include each other.

    With a circular include, the type is not declared yet. Forward-declare it ( class Widget; ) when the function takes a pointer or a reference, and include the header in the .cpp file.

  8. Examples and diagramsMSBuild + CMake

    C2065: Code comes before the precompiled header.

    With precompiled headers, everything before #include "pch.h" is ignored. Make it the first line of the file.

  9. Examples and diagramsMSBuild + CMake

    C2065: The declaration is excluded by the preprocessor.

    Check the #if or #ifdef around it and the preprocessor definitions of the configuration.

  10. Examples and diagramsMSBuild + CMake

    C2065: The declaration is in another scope, or comes later.

    A variable declared inside a block or a loop does not exist after it, and a name must be declared before its first use.

  11. Examples and diagramsMSBuild + CMake

    C2065: The header that declares it is not included.

    Include it in the file that uses the name, instead of relying on another header to include it.

  12. Examples and diagramsMSBuild + CMake

    C2065: The name is misspelled.

    C++ is case-sensitive: Count and count are different names.

  13. Examples and diagramsMSBuild + CMake

    C2065: The name lives in a namespace.

    Write std::cout , or add a using declaration.

  14. Examples and diagramsMSBuild + CMake

    C2084: A .cpp file is included.

    Include headers, never .cpp files.

  15. Examples and diagramsMSBuild + CMake

    C2084: A function is defined in the class and again outside.

    Keep one definition: either the body in the class, or a declaration in the class and the body in the .cpp file.

  16. Examples and diagramsMSBuild + CMake

    C2084: A header that defines functions has no include guard.

    Add #pragma once to the header.

  17. Examples and diagramsMSBuild + CMake

    C2143: A class or struct definition does not end with ; .

    Write }; after the closing brace. The error then appears on the first line after the class, often in another file that includes the header.

  18. Examples and diagramsMSBuild + CMake

    C2143: A type name is unknown.

    In Widget* widget; , if Widget is not declared, the compiler reads it as a variable and expects ; before * . Include its header, qualify it with its namespace, or forward-declare it ( class Widget; ).

  19. Examples and diagramsMSBuild + CMake

    C2143: The previous statement is not finished.

    Look at the line before the one reported: a missing ; , an unclosed parenthesis, or a macro that expands to something unexpected.

  20. Examples and diagramsMSBuild + CMake

    C2143: Two headers include each other.

    One of the two classes is not declared yet when the other uses it. Replace one include with a forward declaration where a pointer or a reference is enough.