error C2061: syntax error : identifier 'PCONTEXT'處理

 最近在做個調用攝像頭數據進行掃描識別的程序,本人愚鈍,環境搭建都要半天時間,之前在windows桌面環境下就弄了半天,現在要將程序移植到wm下,移入之後根本不是想象的那麼輕鬆,由於wm和win桌面操作系統的DirectShow SDK有很多差別,只能是重新搞了。
  幾番周折後又下載了個操作camera的示例源碼,是基於windows標準庫來建立的,爲了想盡快看到是否能成功調用攝像頭,趕緊動手進行項目創建,我的wm SDK只有基於MFC的智能應用程序,只能先創建個空的C++項目了,這樣的話項目比較“純淨”。
  項目創建完成,進行編譯,本來就不寄予多大的希望一次性成功,出現以下錯誤:
  錯誤 1 error C2146: syntax error : missing ';' before identifier 'ContextRecord' F:Program FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iwinnt.h 2978
  錯誤 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:Program FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iwinnt.h 2978
  錯誤 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:Program FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iwinnt.h 2978
  錯誤 4 error C2146: syntax error : missing ';' before identifier 'LPCONTEXT' F:Program FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iwinbase.h 1416
  錯誤 5 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:Program FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iwinbase.h 1416
  錯誤 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:Program FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iwinbase.h 1416
  錯誤 7 error C2061: syntax error : identifier 'LPCONTEXT' F:Program FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iwinbase.h 2119
  錯誤 8 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:Program FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iwinbase.h 2127
  錯誤 9 error C2143: syntax error : missing ',' before '*' F:Program   
FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iwinbase.h 2127
  錯誤 10 error C2040: 'PCONTEXT' : '_CONTEXT *' differs in levels of indirection from 'int' F:Program FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iexcpt.h 65
  錯誤 11 error C2378: 'LPCONTEXT' : redefinition; symbol cannot be overloaded with a typedef F:Program FilesWindows Mobile 6 SDKPocketPCincludeARMV4Iexcpt.h 68
  從上面錯誤中大略可以看出,都是系統文件的問題,應該是環境的問題,所以在經過一些資料查找後,將解決方法羅列如下(首先wm SDK肯定是要提前安裝好的):

  1. 當前項目右鍵-屬性-平臺修改爲windows mobile x SDK
  2. 配置屬性-C/C++-預處理器-預處理器定義欄裏面:     NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;TEST_DLL_EXPORTS;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE
  3. 鏈接器-輸入-附加依賴項:strmbase.lib strmiids.lib
  4. 鏈接器-系統-子系統欄-windows CE
  然後編譯嘍,如果還有錯誤應該跟環境問題沒大的關係了,希望跟我有同樣“遭遇”的新手們能儘快解決問題,由於此問題屬於mobile的開發環境搭建中的基點,所以我故意將標題命名成如上。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章