#include "windows.h"
#define INITGUID
#include "ddraw.h"
int __stdcall WinMain( HINSTANCE InstanceHandleIn, HINSTANCE Dummy, LPSTR CommandLinePointer, int ShowCommand)
{
IDirectDraw * DirectDraw = NULL;
IDirectDraw * DirectDraw2 = NULL;
HRESULT ErrorCode;
MessageBox(NULL,"About to create DirectDraw object.",NULL,NULL);
ErrorCode = DirectDrawCreate(NULL, &DirectDraw, NULL);
if (ErrorCode < 0)
{
MessageBox(NULL, "Unable to create DirectDraw object.",NULL, NULL);
return 0;
}
ErrorCode = DirectDraw->QueryInterface(IID_IDirectDraw2,(void **)&DirectDraw2);
if (ErrorCode < 0)
{
MessageBox(NULL, "Unable to create DirectDraw2 object.",NULL, NULL);
return 0;
}
DirectDraw->Release();
DirectDraw = NULL;
DirectDraw2->Release();
DirectDraw2 = NULL;
return 0;
}
[/source]
by clicking in Build/Rebuild All, I get a linking error.
[source]
Deleting intermediate files and output files for project 'Project - Win32 Debug'.
--------------------Configuration: Project - Win32 Debug--------------------
Compiling...
WinMain.cpp
Linking...
WinMain.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw2
Debug/Project.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Project.exe - 2 error(s), 0 warning(s)
if I click Build/Build Project.exe, I get the same error. But if I remove the line:
#define INITGUID
Then Build/Build Project.exe again (and get the same error again), and the restore the line, and Build/Build Project.exe again, the program compiles and works just fine.
If you want to look at the project, a link to it can be found here.
Topgoro
Edited by - Topgoro on 7/25/00 11:23:29 AM
VC++, weird thing
Hi all.
I wonder if anyone can make any sense out of this:
When I compile the following program:
We emphasize "gotoless" programming in this company, so constructs like "goto hell" are strictly forbidden.
You have to do
#define INITGUID
before all includes...
you could also link with the dxguid.lib file...
Hope this helps
#define INITGUID
before all includes...
you could also link with the dxguid.lib file...
Hope this helps
ICQ: 130925152Email: e.j.folkertsma@student.utwente.nl
quote: Original post by Dark
You have to do
#define INITGUID
before all includes...
you could also link with the dxguid.lib file...
Hope this helps
Thank you very much, I was missing the dxguid.lib. But the quiestion still remains, was not the compile supossed to *ALWAYS* fail without that file?
Topgoro
We emphasize "gotoless" programming in this company, so constructs like "goto hell" are strictly forbidden.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement