包含类的标识符未找到

时间:2013-11-26 00:21:36

标签: c++ visual-c++ include identifier undefined-reference

我有以下“comuni.cpp”文件

#pragma once
#include "afxwin.h"

class Esame: public CObject
{
    DECLARE_SERIAL(Esame)

public:
    INT voto;
    INT crediti;
    BOOL lode;
    CString nome;
    Esame(CString nome, INT voto, BOOL lode, INT crediti) :nome(nome), voto(voto), lode(lode), crediti(crediti) {}
    Esame(){  }
    void Serialize(CArchive &ar)
    {
        CObject::Serialize(ar);
        if (ar.IsStoring())
            ar << nome << "\n" << voto << "\n" << lode << "\n" << crediti << "\n";
        else
            ar >> nome  >> voto >> lode >> crediti;
    }

};
IMPLEMENT_SERIAL(Esame, CObject, 1)


class GestoreId {
private:
    static UINT id;
public:
    static UINT dammi_id()
    {
        id++;
        return id;
    }
};
UINT GestoreId::id;

如果我用另一个

包含此文件
#include "comuni.cpp"

另一个文件只看到Esame Class,但GestoreId给我标识符找不到错误!为什么? 很明显,所有对GestoreId的引用都在include指令之后(然后在声明和定义之后)。如果我在调用者文件中剪切并复制GestoriId定义它可以工作!

0 个答案:

没有答案