Question : error LNK2005: (already defined)

When I compile my program, I see linking errors like this...
  error LNK2005: _IID_IBoundObjectSite already defined in nafxcwd.lib(occsite.obj)

The problem seems related to my using the Platform SDK header files.
Because I am using some functions defined in the wininet.h update,
I have added "C:\Program Files\Microsoft Platform SDK\Include"
under Tools->Options->Directories

When I place the sdk include directory before all others,
I get the redefinition linking errors.

When I place the sdk include directory after all others,
I get compiler errors like this...
  error C2065: 'NIF_INFO' : undeclared identifier
  error C2039: 'szInfo' : is not a member of '_NOTIFYICONDATAA'

So some data-structs and constants are not defined if I list the SDK headers last,
but I will get redefinition link errors, if I put the sdk headers first.
What can I do?

One last clue,...
The problem seems to go away when I put the sdk headers first
and link 'dynamically' not 'staticly' to mfc.

Please help.
Any suggestions are much appreciated.
-c

Answer : error LNK2005: (already defined)

Odds are that the Platform SDK includes newer UUID*.LIB files that finally define this IID, which MFC needs to implement data-bound OLE Controls. I think you should try renaming those libs in your Platform SDK libs directory so that MFC can use its own UUID*.LIB files.

..B ekiM
Random Solutions  
 
programming4us programming4us