我对函数有未定义的引用:
Entry.cpp(程序入口):
................
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();
}
我不知道怎么了我试图缩短代码。说,如果您需要程序的更多代码。谢谢。
抱歉..没有cleanD3D,是cleanD3D。我发帖时弄错了..仍然存在错误未定义的引用..
最佳答案
函数定义缺少类名,并且大小写不正确;
void cleanD3D()
{
...
...应该...
void DX3D_DEFS_AND_FUNC::CleanD3D()
{
...
关于c++ - 未定义对函数c++的引用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20312212/