编译出错,请大家帮忙看看.(directshow的例子)

szy41 2005-03-23 03:49:50
--------------------Configuration: MEDIAR42 - EMULATOR: X86 Win32 (WCE emulator) Debug--

------------------
Platform header files are up-to-date...

MEDIAR42 - 0 error(s), 0 warning(s)
--------------------Configuration: 3 - EMULATOR: X86 Win32 (WCE emulator) Debug---------

-----------
Compiling...
3.cpp
Linking...
corelibc.lib(crtstrta.obj) : error LNK2019: unresolved external symbol _main referenced

in function _mainACRTStartup
EMULATOR__X86Dbg/3.exe : fatal error LNK1120: 1 unresolved externals
Error PB2505: Error executing link.exe.

3.exe - 3 error(s), 0 warning(s)

以上是错误,源码是sdk中的一个例子,我改了一下,现在只有这一个错了.

#include <windows.h>
#include <streams.h>

#define CLASSNAME "VideoWindow"

IGraphBuilder *pGraph = NULL;
IMediaControl *pMediaControl = NULL;
IVideoWindow *pVidWin = NULL;
HWND g_hwnd;

void PlayFile(void)
{
// Create the filter graph manager.
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **)&pGraph);
pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);

// Build the graph.
pGraph->RenderFile(L"clock.avi", NULL);

//Set the video window.
pVidWin->put_Owner((OAHWND)g_hwnd);
pVidWin->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);

RECT grc;
GetClientRect(g_hwnd, &grc);
pVidWin->SetWindowPosition(0, 0, grc.right, grc.bottom);

// Run the graph.
pMediaControl->Run();
}

void CleanUp(void)
{
pVidWin->put_Visible(OAFALSE);
pVidWin->put_Owner(NULL);
pMediaControl->Release();
pVidWin->Release();
pGraph->Release();
}

// Message handler
long FAR PASCAL WindowProc( HWND hwnd, UINT msg, UINT wParam, LONG lParam)
{
switch (msg)
{
case WM_DESTROY:
CleanUp();
PostQuitMessage(0);
break;
default:
return (DefWindowProc(hwnd, msg, wParam, lParam));
}
return(NULL);
}

// Main
int PASCAL WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR pCmdLine, int nCmdShow)
{
MSG msg;
WNDCLASS wc;

CoInitialize(NULL);

ZeroMemory(&wc, sizeof wc);
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInst;
wc.hIcon = NULL;
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
wc.lpszMenuName = NULL;
wc.lpszClassName = _T(CLASSNAME);
RegisterClass( &wc );

g_hwnd = CreateWindow(
_T(CLASSNAME),
_T("DirectShowSample"),
WS_OVERLAPPED,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInst,
NULL);

ShowWindow( g_hwnd, nCmdShow );
UpdateWindow( g_hwnd );
PlayFile();

while( GetMessage( &msg, NULL, 0, 0 ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}

CoUninitialize();
return msg.wParam;
}
...全文
156 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
加库
commctrl.lib
coredll.lib
strmiids.lib
strmbase.lib
uuid.lib
ole32.lib
commdlg.lib
szy41 2005-03-25
  • 打赏
  • 举报
回复
我试试.
szy41 2005-03-24
  • 打赏
  • 举报
回复
我好象看到ms上说LNK2019可能是个bug.
要在编译时加/Gz,但试了没用。
szy41 2005-03-24
  • 打赏
  • 举报
回复
我在evc下编译通过了,但是没有屏幕是黑的,不知为什么。
cryptonym 2005-03-24
  • 打赏
  • 举报
回复
wince里支持directx吗?我的怎么不行啊?
szy41 2005-03-24
  • 打赏
  • 举报
回复
up
szy41 2005-03-23
  • 打赏
  • 举报
回复
原来的没有说啊,我加了strmbase.lib,ole32.lib,strmiids.lib

还有吗??
httpaspjspphp 2005-03-23
  • 打赏
  • 举报
回复
不好意思
我以前也遇到过类似问题
具体解决忘了
好像是在Project -> setting->link 中加入了一个.lib你对着原来的那个看看
另外,在C++选项中好像也要改一下
你仔细点
应该能解决的
szy41 2005-03-23
  • 打赏
  • 举报
回复
请问该怎么办?
httpaspjspphp 2005-03-23
  • 打赏
  • 举报
回复
设置不对阿

19,520

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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