C++ / Documentation search
Find the error. Find the next step.
Search by diagnostic code, copied message, or symptom. Filter by content and project system.
205 results
Browse documentation →C2280: A lambda that owns one is stored in std::function .
std::function requires a copyable callable: use std::move_only_function in C++23, or a std::shared_ptr .
C2280: A member makes assignment impossible.
A const or reference member deletes the copy assignment: assign member by member, or store a pointer.
C2280: A non-copyable object is copied.
std::unique_ptr , std::thread , and std::mutex cannot be copied: pass them by reference, or transfer movable types with std::move . A std::mutex cannot be moved either; share it by reference.
C2440: A void* becomes a typed pointer.
C++ needs an explicit static_cast<T*> , for example on the result of malloc .
C2440: A pointer to const data is assigned to a pointer to mutable data.
Preserve the pointed-to type's const , rather than casting const away.
C2440: A string literal is assigned to char* .
String literals are constant. Since conformance mode ( /permissive- ) is on in new projects, write const char* or use std::string .
C2440: An enum class is used as an integer.
Scoped enumerations do not convert implicitly: use static_cast<int> .
C2440: The types are unrelated.
No cast makes unrelated types compatible safely: check that you use the variable you meant.
C2512: A container creates elements without arguments.
std::map::operator[] , vector::resize , and arrays need a default constructor: use map.at , try_emplace , or emplace_back instead.
C2512: A member or a base class has no default constructor.
Initialize it in the member initializer list of every constructor: Line() : start(0, 0), end(0, 0) {} .
C2512: The class declares only constructors with parameters.
Pass the arguments, or add a default constructor: Point() = default; with default member values.
C2664: A const object is passed to a non-const parameter.
Make the parameter const , or pass a copy.
C2664: A narrow string is passed to a Unicode Windows function.
With Character Set set to Unicode, MessageBox is MessageBoxW and expects wide strings: write L"Hello" , call MessageBoxA , or use TEXT("Hello") .
C2664: A temporary is passed to a non-const reference.
A parameter std::string& does not accept a literal or a temporary: take const std::string& when the function does not change it.
C2664: The arguments are in the wrong order.
Compare the call with the declaration the message shows; another overload may be the one you meant.
C3861: The function is defined below the call.
Declare it before the call ( int Compute(int); ), in a header or at the top of the file, or move its definition above.
C3861: The function is in a namespace.
Qualify it, for example std::sort or utils::Compute .
C3861: The function is inside #ifdef .
Its declaration may be excluded for this configuration or platform: check the preprocessor definitions of the configuration you build.
C3861: The header that declares it is not included.
Include it: std::max needs <algorithm> , printf needs <cstdio> .
C4244: Arithmetic on small types is assigned back.
char and short are promoted to int in expressions: cast the result when you store it in the smaller type.