Reputation: 97
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..
Upvotes: 0
Views: 319
Reputation: 180917
The function definition is missing the class name, and is not cased correctly;
void cleanD3D()
{
...
...should be...
void DX3D_DEFS_AND_FUNC::CleanD3D()
{
...
Upvotes: 0
Reputation: 880
Function names in C++ are case sensitive. Try:
dx3d_defsnfunc.CleanD3D();
Upvotes: 3