adb工具編譯錯誤解決。
一。編譯AdbWinApi:
(a) error C2664: 'CreateFileA' : cannot convert parameter 1 from 'const unsigned short *' to 'const char *'
解決辦法:將專案的字符集設定成unicode:
-------------------------------------------------------------------------------------------------------------------------------------------------------
.
(b).>d:\work\project\adb_dev\api\adb_api_instance.h(103): error C2146: 語法錯誤: 缺少“;”(在識別符號“instance_handle_”的前面)
1>d:\work\project\adb_dev\api\adb_api_instance.h(103): error C4430: 缺少型別說明符 - 假定為 int。注意: C++ 不支援預設 int
1>d:\work\project\adb_dev\api\adb_api_instance.h(110): error C2065: “ADBAPIINSTANCEHANDLE”: 未宣告的識別符號
1>d:\work\project\adb_dev\api\adb_api_instance.h(110): error C2923: “std::map”: 對於引數“_Kty”,“ADBAPIINSTANCEHANDLE”不是有效的 模板 型別變數
1>d:\work\project\adb_dev\api\adb_api_instance.cpp(39): error C2065: “instance_handle_”: 未宣告的識別符號
1>d:\work\project\adb_dev\api\adb_api_instance.cpp(40): error C2061: 語法錯誤: 識別符號“ADBAPIINSTANCEHANDLE”
解決辦法:在檔案中新增typedef void* ADBAPIINSTANCEHANDLE;
----------------------------------------------------------------------------------------------------------------------------------------------------------------
解決辦法:在依賴項中新增setupapi.lib
二.AdbWinUsbApi編譯出錯:
(a)
1>d:\work\project\adb_dev\winusb\adb_winusb_interface.h(170): error C2146: 語法錯誤: 缺少“;”(在識別符號“winusb_handle”的前面)
1>d:\work\project\adb_dev\winusb\adb_winusb_interface.h(170): error C4430: 缺少型別說明符 - 假定為 int。注意: C++ 不支援預設 int
解決辦法:
stdafx.h的修改:
將win的版本號改成0x602
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
//#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 2000 or later.
#define _WIN32_WINNT 0x0602
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
//#define _WIN32_WINDOWS 0x0500 // Change this to the appropriate value to target Windows Me or later.
#define _WIN32_WINDOWS 0x0602
#endif