|
IDE环境 VC6.0 + sp6 + DX9.0 SDK
IDE的include和lib都已经设置好,DX的include和lib都在搜索目录的最前
测试一 创建一个console空工程
添加一个main.cpp
工程的ddraw.lib已经添加在lib module里面
代码如下
#define INITGUID
#include <windows.h> // include important windows stuff
#include <ddraw.h> // include directdraw
int main()
{
void* lpdd = NULL;
if (FAILED(DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL)))
return(0);
return 0;
}
可以编译通过
测试二 创建一个dll简单工程test_dll
在test_dll.cpp中代码如下
ddraw.lib 也添加到工程的lib module下
#include "stdafx.h"
#include <ddraw.h> // include directdraw
#define INITGUID
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
void* lpdd = NULL;
// create IDirectDraw interface 7.0 object and test for error
if (FAILED(DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL)))
return(0);
return TRUE;
}
出现编译错误
--------------------Configuration: test_dll - Win32 Debug--------------------
Linking...
test_dll.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw7
Debug/test_dll.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
test_dll.dll - 2 error(s), 0 warning(s)
不知道为什么会这样?大家看看到底出了什么问题
|
|