I am creating a C++ MFC DLL based on a third party SDK in Visual Studio 2008. The SDK provides a TLB folder, a Lib folder (.lib only), an Include folder (.h and .hpp only) and a Bin folder (some exes, DLL and .ax files). I tried to link the SDK library to my DLL in the following way:
- C/C++ -> General -> Additional Include Directories – Bin, Include and TLB folder (just in case);
- Linker -> General -> Additional Library Directories – Lib and Bin;
- Linker -> Input -> Additional Dependencies – the .lib’s in the Lib folder
Doing things this way I get compiling errors due to linking problems (undeclared indentifiers and such), so I added an import line for the TLB’s:
#import "C:\Path\To\Tlb.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
This pops another compiling errors about type redefinitions:
error C2011: '_SYSTEMTIME' : 'struct' type redefinition
What am I missing? I am quite new to Windows programming.
Thanks in advance.
I don’t know why _SYSTEMTIME is redefined when it is defined in
<Windows.h>or something brought in by it.Anyway, try removing no_namespaces from the #import directive. Namespaces are there to avoid name clashes like these.