Error loading type library/DLL
When I use the following code I get an compilation error
#import <dwmapi.lib>
#include <dwmapi.h>
I get the following error:
fatal error C1083: Cannot open type library file: 'c:\program files\microsoft sdks\windows\v7.0a\lib\dwmapi.lib': Error loading type 开发者_StackOverflow中文版library/DLL.
Intellisense says:
2 IntelliSense: cannot open source file "c:/users/####/documents/visual studio 2010/Projects/modlauch/modlauch/Debug/dwmapi.tlh": Bad file descriptor c:\users\####\documents\visual studio 2010\projects\modlauch\modlauch\modlauchdlg.cpp 7 1 modlauch
Does anyone know how to solve it? I'm sure that my 'dwmapi' library is fine and there is nothing wrong with it. I'm using MFC with VS2010 , but I don't think that is related to the problem. (Platform - Win32)
If I get rid of "#import" then I get "unresolved external symbol __imp__DwmExtendFrameIntoClientArea@8" error.
This isn't the answer to your problem, but for others who arrive here with that error message - if you accidentally type #import "Header.h"
rather than #include "Header.h"
when including from a .lib then you will get that error.
dwmapi .lib is a type library? YOu sure its not just a plain old dll. A com lib is either .DLL or .tlb.
I think its a plain old dll. So you dont #import it you need instead
#pragma comment(lib,"dwmapi.lib")
A type library is not a normal object library.
Type libraries are typically found in DLL's, OCX files and TLB files.
The few times I #import'ed a type library it always one of those, never a .LIB file.
Use the REGTLB or REGTLIB command (you may have to look this up in Google) to register a type library in your system. It's similar to REGSVR32, but registers a type library rather than a COM component.
You can also use OLEVIEW to view the contents of a type library.
精彩评论