vc调试问题

zengdeping_362321 2009-11-04 04:06:08
我调试时出现下列问题,难解决啊,请各位大虾指点:
MoviePlayView.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw3
MoviePlayView.obj : error LNK2001: unresolved external symbol _CLSID_DirectDrawFactory
MoviePlayView.obj : error LNK2001: unresolved external symbol _IID_IDirectDrawFactory
Debug/MoviePlay.exe : fatal error LNK1120: 3 unresolved externals

源代码在这里:
HRESULT CMovieView::InitDDrawEx()
{
HRESULT hr=NOERROR;
DDSURFACEDESC ddsd, ddsd2, ddsd3;

CoInitialize(NULL);

//Create a DirectDrawFactory object
hr = CoCreateInstance(
CLSID_DirectDrawFactory, NULL, CLSCTX_INPROC_SERVER,
IID_IDirectDrawFactory, (void **)&m_pDDF);
if (FAILED(hr))
{
AfxMessageBox(_T("Couldn't create DirectDrawFactory"));
return E_FAIL;
}


//Call the IDirectDrawFactory::CreateDirectDraw method to create the
//DirectDraw object, set the cooperative level, and get the address
//of an IDirectDraw interface pointer
hr = (m_pDDF->CreateDirectDraw(NULL, ::GetDesktopWindow(), DDSCL_NORMAL,
NULL, NULL, &m_pDD));

if (FAILED(hr))
{
AfxMessageBox(_T("Couldn't create DirectDraw object"));
return E_FAIL;
}

//Now query for the new IDirectDraw3 interface
hr =(m_pDD->QueryInterface(IID_IDirectDraw3, (LPVOID*)&m_pDD3));

if (FAILED(hr))
{
AfxMessageBox(_T("Couldn't get IDirectDraw3"));
return E_FAIL;
}

//Initialize the DDSURFACEDESC structure for the primary surface
::ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hr = m_pDD3->CreateSurface(&ddsd, &m_pPrimarySurface, NULL);

if(FAILED(hr))
{
AfxMessageBox(_T("Couldn't create Primary Surface"));
return E_FAIL;
}


// Now, do the same for the offscreen surfaces.

// The offscreen surface needs to use the same pixel format as the primary.
// Query the primary surface to for its pixel format.
hr = m_pPrimarySurface->GetSurfaceDesc(&ddsd);
if(FAILED(hr))
{
AfxMessageBox(_T("Couldn't GetSurfaceDesc"));
return E_FAIL;
}

// Now, set the info for the offscreen surface #1, using the primary's pixel format.
::ZeroMemory(&ddsd2, sizeof(ddsd2));
ddsd2.dwSize = sizeof(ddsd2);
ddsd2.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd2.dwHeight = ddsd.dwHeight; //set the height of the surfaces equal
ddsd2.dwWidth = ddsd.dwWidth; //set the width of the surfaces equal
ddsd2.ddpfPixelFormat = ddsd.ddpfPixelFormat; //set the pixel formats equal


// Now, create the offscreen surface #1 and query for the latest interface.
hr = m_pDD3->CreateSurface(&ddsd2, &m_pDDSOffscreen, NULL);
if(FAILED(hr))
{
AfxMessageBox(_T("Couldn't create Offscreen Surface"));
return E_FAIL;
}


// Now, set the info for the offscreen surface #2, using the primary's pixel format.
::ZeroMemory(&ddsd3, sizeof(ddsd3));
ddsd3.dwSize = sizeof(ddsd3);
ddsd3.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
ddsd3.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd3.dwHeight = ddsd.dwHeight; //set the height of the surfaces equal
ddsd3.dwWidth = ddsd.dwWidth; //set the width of the surfaces equal
ddsd3.ddpfPixelFormat = ddsd.ddpfPixelFormat; //set the pixel formats equal


// Now, create the offscreen surface #2 and query for the latest interface.
hr = m_pDD3->CreateSurface(&ddsd3, &m_pDDSOffscreen2, NULL);
if(FAILED(hr))
{
AfxMessageBox(_T("Couldn't create Offscreen Surface2"));
return E_FAIL;
}




//Add code for Clipper
hr = m_pDD3->CreateClipper(0, &m_pDDClipper, NULL);
if(FAILED(hr))
{
AfxMessageBox(_T("Couldn't create Clipper"));
return E_FAIL;
}

hr = m_pPrimarySurface->SetClipper(m_pDDClipper);
if(FAILED(hr))
{
AfxMessageBox(_T("Call to SetClipper failed"));
return E_FAIL;
}


hr = m_pDDClipper->SetHWnd(0, AfxGetMainWnd()->m_hWnd);
if(FAILED(hr))
{
AfxMessageBox(_T("Call to SetHWnd failed"));
return E_FAIL;
}

return NOERROR;
}
...全文
125 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
天鹅梦 2009-11-05
  • 打赏
  • 举报
回复
蒋大侠都出现了,还等什么,照他说的做吧
ToperRay 2009-11-05
  • 打赏
  • 举报
回复
基础不牢,调试、链接、编译概念不清,楼主要加强啊。
蒋晟 2009-11-05
  • 打赏
  • 举报
回复
要2004年之前版本的DirectX SDK。
ja_jerry 2009-11-04
  • 打赏
  • 举报
回复
你没有包含_IID_IDirectDraw3 等的定义所在的头文件
fandh 2009-11-04
  • 打赏
  • 举报
回复
你这是链接错误,还没有到调试呢!
你看看你是不是用了什么头文件,而没有设置lib文件!
candeabc123 2009-11-04
  • 打赏
  • 举报
回复
连接错误,就是找不到目标标识符。
看看你的接口是什么接口,能不能正确调用?
还是该包含的文件没包含。
我菜鸟 只能提示下了 其他原因还望高手指点
ziplj 2009-11-04
  • 打赏
  • 举报
回复
几乎可以肯定这个帖子没有人看... 除非是出过同样的错误

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧