VC2005下的编译错误

1。

1>d:/study/vc2005/wmi/wmi/wmi.cpp(27) : error C2065: 'COINIT_MULTITHREADED' : undeclared identifier
1>d:/study/vc2005/wmi/wmi/wmi.cpp(27) : error C3861: 'CoInitializeEx': identifier not found
1>d:/study/vc2005/wmi/wmi/wmi.cpp(39) : error C2065: 'EOAC_NONE' : undeclared identifier
1>d:/study/vc2005/wmi/wmi/wmi.cpp(31) : error C3861: 'CoInitializeSecurity': identifier not found
1>d:/study/vc2005/wmi/wmi/wmi.cpp(69) : error C3861: 'CoSetProxyBlanket': identifier not found

是在调用com的函数库时出现的错误,下面的头文件和库已经导入

#include <objbase.h>

#pragma comment(lib, "ole32.lib")

 

解决方法:加入宏

 

#define _WIN32_WINNT 0x0400

#include <objbase.h>

#pragma comment(lib, "ole32.lib")

 

或者


#define _WIN32_DCOM
#include <comdef.h>

 

2。

error LNK2019: 无法解析的外部符号 "void __stdcall _com_issue_error(long)" (?_com_issue_error@@YGXJ@Z),该符号在函数 "public: __thiscall _bstr_t::_bstr_t(wchar_t const *)" (??0_bstr_t@@QAE@PB_W@Z) 中被引用
解决方法:加入头文件

#include <comdef.h>

 

3.d:/study/vc2005/event/event/basetoolbar.cpp(42) : error C2027: use of undefined type 'CDockBar'

查MSDN:

Compiler Error C2027

use of undefined type 'type'

A type cannot be used until it is defined. To resolve the error, be sure the type is fully defined before referencing it. The following sample generates C2027:

// C2027.cpp
class D;

/* resolve the error by defining the class
class D {
public:
   void func() {
   }
};
*/

int main() {
   D *pD;
   pD->func();   // C2027
}

解决方法: 加入头文件
#include "afxpriv.h"
 
4. 在目标机上发布错误
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem
解决方法:
把Program Files/Microsoft Visual Studio 8/SDK/v2.0/BootStrapper/Packages/vcredist_x86/vcredist_x86.exe安装到目标机器上

你可能感兴趣的:(c,application,compiler,X86)