The following sample generates C2065.
// C2065.cpp
// compile with: /EHsc
// using namespace std;
#include <iostream>
int main() {
cout << "Hello" << endl; // C2065
// try the following line instead
std::cout << "Hello" << std::endl;
}
When calling a generic function, if the intended type argument cannot be deduced from the parameters used, the compiler will report an error. For more information, see Generic Functions.
The following sample generates C2065.
// C2065_b.cpp
// compile with: /clr
generic <typename ItemType>
void G(int i) {}
int main() {
// global generic function call
G<T>(10); // C2065
G<int>(10); // OK
}
This error can also be generated as a result of compiler conformance work that was done for Visual C++ 2005: parameter checking for Visual C++ attributes. See Breaking Changes in the Visual C++ 2005 Compiler for more information.
The following sample generates C2065.
// C2065_c.cpp
// compile with: /c
[module(DLL, name=MyLibrary)]; // C2065
// try the following line instead
// [module(dll, name="MyLibrary")];
[export]
struct MyStruct {
int i;
};