0
votes

Here is my simple setup: (i've hidden lots of unneeded information)

//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();
}

This setup produces the error:

3>AutoFocusTest.obj : error LNK2001: unresolved external symbol "public: __cdecl camera_avtcam_ex_t::camera_avtcam_ex_t(void)" (??0camera_avtcam_ex_t@@QEAA@XZ)

From everything I've read on this relatively common problem, I have not linked something causing my camera_avtcam_ex_t function definitions to not be found. However, I can't figure out what I could have missed. I have added all of the include directories and library directories, as well as added the library files to the additional dependencies section.

Can anyone spot anything that I might be missing?

1
You mean surely mCamera = new camera_avtcam_ex_t(); or not? - Leo Chapiro
////class function definitions doesn't actually define the functions, you know that, right? - Luchian Grigore
Definitions of default constructor and destructor. Specifically, the error you posted mentions the default constructor of camera_avtcam_ex_t. - jrok
@duDE why would that matter? - Luchian Grigore
@duDE yes sorry, i just typed it wrong here - xcdemon05

1 Answers

1
votes

Assuming you have defined the constructor for your camera_avtcam_ex_t, it's declared as private, you can't instantiate it.