链接器找不到函数定义,LNK2001未解析的外部符号

时间:2013-03-13 13:23:30

标签: c++ visual-studio-2010 visual-studio linker unresolved-external

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

//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:未解析的外部符号          “public:__ cdecl camera_avtcam_ex_t :: camera_avtcam_ex_t(void)”          (?? 0camera_avtcam_ex_t @@ @ QEAA XZ)

从我读过的关于这个相对常见问题的所有内容来看,我没有链接导致我的camera_avtcam_ex_t函数定义无法找到的东西。但是,我无法弄清楚我可能错过了什么。我添加了所有include目录和库目录,并将库文件添加到其他依赖项部分。

有人能发现我可能遗失的任何东西吗?

1 个答案:

答案 0 :(得分:1)

假设您的camera_avtcam_ex_t的构造函数已定义声明private,则无法实例化它。