这是我的简单设置:(我隐藏了很多不需要的信息)

//AutoFocusTest.h
#include "camAVTEx.h"

class CAutoFocusTestApp : public CWinApp
{
protected:
    camera_t* mCamera;

public:
    virtual BOOL InitInstance();
};

//camAVTEx.h
class camera_avtcam_ex_t : public camera_t
{
public:
    camera_avtcam_ex_t();
    virtual ~camera_avtcam_ex_t();

    //member variables

    //member function declarations
}

//camAVTEx.cpp
#include "camAVTEx.h"

camera_avtcam_ex_t::camera_avtcam_ex_t()
{
    //stuff
}

camera_avtcam_ex_t::~camera_avtcam_ex_t()
{
    //stuff
}

//the rest are defined here in my program

//AutoFocusTest.cpp
#include AutoFocusTest.h

BOOL CAutoFocusTestApp::InitInstance()
{
    mCamera = new camera_avtcam_ex_t();
}


此设置产生错误:


  3> AutoFocusTest.obj:错误LNK2001:未解析的外部符号
         “公共:__ cdecl camera_avtcam_ex_t :: camera_avtcam_ex_t(无效)”
         (?? 0camera_avtcam_ex_t @@ QEAA @ XZ)


从我阅读的有关此相对常见问题的所有内容来看,我尚未链接某些东西,导致找不到我的camera_avtcam_ex_t函数定义。但是,我不知道自己该错过什么。我添加了所有包含目录和库目录,并将库文件添加到其他依赖项部分。

谁能发现我可能会丢失的东西?

最佳答案

假设您已经为camera_avtcam_ex_t定义了构造函数,则将其声明为private,则无法实例化它。

10-04 12:16