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 →C2259: A pure virtual function is not implemented.
Implement every pure virtual function of the base classes in the derived class.
C2259: The base class is created directly.
Create the derived class, and use a pointer or a reference to the base.
C2259: The signature differs from the base class.
A missing const , another parameter type, or another calling convention declares a new function instead of overriding. Write override on each override: the compiler then reports the mismatch directly (C3668).
C2280: A class that contains one is copied.
A class with a unique_ptr member cannot normally be copied. If it has an available move constructor, move it into containers ( push_back(std::move(item)) ), or construct it with emplace_back . A user-declared destructor can prevent an…
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.