ScribbleView.obj : error LNK2001:
 unresolved external symbol "protected: virtual void __thiscall CScribbleView::OnEndPrinting(class CDC *,struct CPrintInfo *)" (?OnEndPrinting@CScribbleView@@MAEXPAVCDC@@PAUCPrintInfo@@@Z)

解决方案 »

  1.   

    你在CScribbleView中申明了OnEndPrinting,但CPP文件中没有该函数的实现,
    连接器没找到实现,所以就提示了
    http://www.dpspace.com
      

  2.   

    Code references something (such as a function, variable, or label) that the linker can't find in the libraries and object files.Possible causes What the code asks for doesn't exist (the symbol is spelled incorrectly or uses the wrong case, for example). 
    The code asks for the wrong thing (you are using mixed versions of the libraries, some from one version of the product, others from another version).
      

  3.   

    OnEndPrinting是一个虚函数,要求你必须重载这个函数,如果不是你在类中定义了这个函数的话,就应该是这个原因!
      

  4.   

    Coding Problems Mismatched case in your code or module-definition (.DEF) file can cause LNK2001. For example, if you named a variable “var1” in one C++ source file and tried to access it as “VAR1” in another, you would receive this error. The solution is to exactly match the case of the symbol in all references.
    A project that uses function inlining yet defines the functions in a .CPP file rather than in the header file can cause LNK2001. 
    If you are using C++, make sure to use extern “C” when calling a C function from a C++ program. By using extern “C” you force the use of the C naming convention. Be aware of compiler switches like /Tp or /Tc that force a file to be compiled as a C (/Tc) or C++ (/Tp) file no matter what the filename extension, or you may get different function names than you expect.
    Attempting to reference functions or data that don't have external linkage causes LNK2001. In C++, inline functions and const data have internal linkage unless explicitly specified as extern. 
    A missing function body or variable will cause LNK2001. Having just a function prototype or extern declaration will allow the compiler to continue without error, but the linker will not be able to resolve your call to an address or reference to a variable because there is no function code or variable space reserved. 
    Name decoration incorporates the parameters of a function into the final decorated function name. Calling a function with parameter types that do not match those in the function declaration may cause LNK2001. 
    Incorrectly included prototypes will cause the compiler to expect a function body that is not provided. If you have both a class and non-class implementation of a function F, beware of C++ scope-resolution rules. 
    When using C++, make sure that you include the implementation of a specific function for a class and not just a prototype in the class definition. 
    Attempting to call a pure virtual function from the constructor or destructor of an abstract base class will cause LNK2001 since by definition a pure virtual function has no base class implementation. 
    Only global functions and variables are public. 
    Functions declared with the static modifier by definition have file scope. Static variables have the same limitation. Trying to access any static variables from outside of the file in which they are declared can result in a compile error or LNK2001. A variable declared within a function (a local variable) can only be used within the scope of that function. C++ global constants have static linkage. This is different than C. If you try to use a global constant in C++ in multiple files you get error LNK2001. One alternative is to include the const initializations in a header file and include that header in your .CPP files when necessary, just as if it was a function prototype. Another alternative is to make the variable non-constant and use a constant reference when assessing it.