Frage

I have undefined reference to function :

Entry.cpp (program entry):

................
ShowWindow(hWnd, nCmdShow);
DX3D_DEFS_AND_FUNC dx3d_defsnfunc;
dx3d_defsnfunc.initD3D(hWnd);
MSG msg;

while(TRUE)
{
    while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    if(msg.message == WM_QUIT)
        break;

    dx3d_defsnfunc.render_frame();
}

dx3d_defsnfunc.cleanD3D(); //undefined reference to DX3D_DEFS_AND_FUNC::CleanD3D(); 

return msg.wParam;
}

DirectX9.h:

class DX3D_DEFS_AND_FUNC

...
public:
void cleanD3D();
...

DirectX9.cpp:

    void cleanD3D()
{
    dx9_func_def.v_buffer->Release();
    dx9_func_def.d3ddev->Release();
    dx9_func_def.d3d->Release();
}

I have no idea what's wrong. I tried to shorter the code. Say, if u need more code of the program. Thank you.

Sorry.. There was cleanD3D not CleanD3D. I mistaked when i posted.. There is still error undefined reference..

War es hilfreich?

Lösung 3

The function definition is missing the class name, and is not cased correctly;

void cleanD3D()
{
   ...

...should be...

void DX3D_DEFS_AND_FUNC::CleanD3D()   
{
   ...

Andere Tipps

C++ is case sensitive cleanD3D != CleanD3D.

Function names in C++ are case sensitive. Try:

dx3d_defsnfunc.CleanD3D();
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top