I have the following problem: My project contains 2 Files using DirectX
stuff. File1
uses #define INITGUID and file2 is using #include <initguid.h> compiling
is fine, but
I always get linker errors - no matter what I try. In this case :
netplayer.obj : error LNK2005: _IID_IDirectDrawSurface3 already defined
in VoiceRecording.obj
When I remove the #define INITGUID in file1.c I get :
VoiceRecording.obj : error LNK2001: unresolved external symbol
_IID_IDirectSoundNotify
If remove the initguid.h in file2.cpp I receive:
netplayer.obj : error LNK2001: unresolved external symbol
_IID_IDirectDraw3
netplayer.obj : error LNK2001: unresolved external symbol
_CLSID_DirectDrawFactory
netplayer.obj : error LNK2001: unresolved external symbol
_IID_IDirectDrawFactory
Does anybody know how I can get rid of that problem.
I really appreciate any help/hint - thanks,
Kilian
file1.c
#define WIN32_LEAN_AND_MEAN
#define INITGUID
//#include <initguid.h>
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <dsound.h>
#include <commctrl.h>
#include <commdlg.h>
#include <memory.h>
#include <cderr.h>
#include "dsstream.h"
#include "wassert.h"
file2.cpp
#include <windows.h>
#include <windowsx.h>
#include <winbase.h>
#include <math.h>
#include <mmstream.h> // Multimedia stream interfaces
#include <amstream.h> // DirectShow multimedia stream interfaces
#include <ddstream.h> // DirectDraw multimedia stream interfaces
#include <initguid.h> // Defines DEFINE_GUID macro and enables GUID
initialization
#include <ddrawex.h> // DirectDrawEx interfaces
#include <string.h>
#define APPLICATIONNAME "Video Annotation Tool"
#define CLASSNAME "MMSDDRAWEXWINDOW"
#include <control.h>
#include <commctrl.h>
#include <streams.h>
#include <stdio.h>
#include "MessagingStuff.h"
#include <fstream.h>
#include <time.h>
#include <process.h>
#include "VoiceRecording.h"
Huang Wenhai wrote:
> You should add the ddraw.lib to your project manually!
> And add #include <ddraw.h> in the header of you file!
Thanks for your answer, but I won't solve the problem.
I already link ddraw.lib and I use #include <ddrawex.h>
which includes ddraw.h
Kilian