hnyyy(前进):我已经#include"afxcoll.h"了呀!不是这个原因。

解决方案 »

  1.   

    不是这个原因啊,我#include "afxcoll.h"了。
      

  2.   

    IMPLEMENT_SERIAL
    这个宏用了么?
      

  3.   

    cpp 中少了一个IMPLEMENT_SERIAL
      

  4.   

    IMPLEMENT_SERIAL这个宏有什么用?为什么会出这个错?能不能详细的讲一下啊?
      

  5.   

    看MSDN啊
    IMPLEMENT_SERIAL
    Generates the C++ code necessary for a dynamic CObject-derived class with run-time access to the class name and position within the hierarchy. Use the IMPLEMENT_SERIAL macro in a .CPP module; then link the resulting object code only once.IMPLEMENT_SERIAL( 
    class_name, 
    base_class_name, 
    wSchema )
    Parameters
    class_name 
    The actual name of the class (not enclosed in quotation s). 
    base_class_name 
    The name of the base class (not enclosed in quotation s). 
    wSchema 
    A UINT “version number” that will be encoded in the archive to enable a deserializing program to identify and handle data created by earlier program versions. The class schema number must not be –1. 
    Res
    You can use the AFX_API macro to automatically export the CArchive extraction operator for classes that use the DECLARE_SERIAL and IMPLEMENT_SERIAL macros. Bracket the class declarations (located in the .H file) with the following code:#undef AFX_API
    #define AFX_API AFX_EXT_CLASS<your class declarations here>#undef AFX_API
    #define AFX_APIUsing the DECLARE_SERIAL Macro
    The DECLARE_SERIAL macro is required in the declaration of classes that will support serialization, as shown here:class CPerson : public CObject
    {
        DECLARE_SERIAL( CPerson )
        // rest of declaration follows...
    };Defining a Constructor with No Arguments
    MFC requires a default constructor when it re-creates your objects as they are deserialized (loaded from disk). The deserialization process will fill in all member variables with the values required to re-create the object.This constructor can be declared public, protected, or private. If you make it protected or private, you ensure that it will only be used by the serialization functions. The constructor must put the object in a state that allows it to be safely deleted if necessary.Note   If you forget to define a constructor with no arguments in a class that uses the DECLARE_SERIAL and IMPLEMENT_SERIAL macros, you will get a “no default constructor available” compiler warning on the line where the IMPLEMENT_SERIAL macro is used.Example
    // MyClass.cpp
    #include "stdafx.h"
    #include "MyClass.h"IMPLEMENT_SERIAL( CMyClass, CObject, VERSIONABLE_SCHEMA | 2 )...