ID3DBlob 未聲明的標記符 undefined signal
ID3DBlob 定義在 D3DCommon.h 中, 但是 使用 vs2010 & DirectX11 聯合開發時, D3DCommon.h 會有兩份, 如我的環境是:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\D3DCommon.h D:\Program Files\Microsoft DirectX SDK (June 2010)\Include\D3Dcommon.h
這樣, 即使 在項目中有 包含 d3dx11.h (包含 D3DCommon.h) 也不能正確進行 編譯, 需要將 DirectX11 sdk 包含目錄 在 Windonws sdk 的前面, 如:
D3DCOMPILE_ENABLE_STRICTNESS 未聲明標記符
D3DX11CompileFromFile() 創建 加載並編譯 shader文件時 需要用到 的 shaderFlags , 定義在 D3DCompiler.h 中, 需要 include
xnamath.h 報錯: 在標識符“XMConvertToRadians”的前面
如下報錯:
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(159): error C2146: 語法錯誤: 缺少“;”(在標識符“XMConvertToRadians”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(159): error C2433: “FLOAT”: 不允許在數據聲明中使用“__forceinline”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(159): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(159): error C2146: 語法錯誤: 缺少“)”(在標識符“fDegrees”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(159): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(159): error C2059: 語法錯誤:“)”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(159): error C2143: 語法錯誤 : 缺少“;”(在“{”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(159): error C2447: “{”: 缺少函數標題(是否是老式的形式表?)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(160): error C2146: 語法錯誤: 缺少“;”(在標識符“XMConvertToDegrees”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(160): error C2433: “FLOAT”: 不允許在數據聲明中使用“__forceinline”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(160): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(160): error C2086: “int FLOAT”: 重定義
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(159) : 參見“FLOAT”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(160): error C2146: 語法錯誤: 缺少“)”(在標識符“fRadians”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(160): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(160): error C2059: 語法錯誤:“)”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(160): error C2143: 語法錯誤 : 缺少“;”(在“{”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(160): error C2447: “{”: 缺少函數標題(是否是老式的形式表?)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(217): error C2146: 語法錯誤: 缺少“;”(在標識符“__vector4i”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(217): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(217): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(246): error C2146: 語法錯誤: 缺少“;”(在標識符“i”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(246): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(246): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(260): error C2146: 語法錯誤: 缺少“;”(在標識符“u”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(260): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(260): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(316): error C2061: 語法錯誤: 標識符“FLOAT”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(316): error C2805: 二進制“operator *=”的參數太少
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(317): error C2061: 語法錯誤: 標識符“FLOAT”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(317): error C2805: 二進制“operator /=”的參數太少
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(323): error C2061: 語法錯誤: 標識符“FLOAT”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(324): error C2146: 語法錯誤: 缺少“)”(在標識符“S”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(324): error C2365: “operator *”: 重定義;以前的定義是“函數”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(324): error C2440: “初始化”: 無法從“int”轉換為“XMVECTOR”
1> 無構造函數可以接受源類型,或構造函數重載決策不明確
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(324): error C2059: 語法錯誤:“)”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(325): error C2061: 語法錯誤: 標識符“FLOAT”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(325): error C2805: 二進制“operator /”的參數太少
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(342): error C2146: 語法錯誤: 缺少“;”(在標識符“_11”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(342): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(342): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(342): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(342): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(342): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(343): error C2146: 語法錯誤: 缺少“;”(在標識符“_21”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(343): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(343): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(343): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(343): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(343): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(344): error C2146: 語法錯誤: 缺少“;”(在標識符“_31”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(344): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(344): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(344): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(344): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(344): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(345): error C2146: 語法錯誤: 缺少“;”(在標識符“_41”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(345): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(345): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(345): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(345): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(345): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(347): error C2146: 語法錯誤: 缺少“;”(在標識符“m”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(347): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(347): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(354): error C2061: 語法錯誤: 標識符“FLOAT”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(354): error C2535: “_XMMATRIX::_XMMATRIX(void)”: 已經定義或聲明成員函數
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(352) : 參見“_XMMATRIX::_XMMATRIX”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(358): error C2061: 語法錯誤: 標識符“CONST”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(358): error C2535: “_XMMATRIX::_XMMATRIX(void)”: 已經定義或聲明成員函數
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(352) : 參見“_XMMATRIX::_XMMATRIX”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(360): error C2143: 語法錯誤 : 缺少“;”(在“(”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(360): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(360): error C3646: “CONST”: 未知重寫說明符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(360): error C2719: “Row”: 具有 __declspec(align('16')) 的形參將不被對齊
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(360): error C2719: “Column”: 具有 __declspec(align('16')) 的形參將不被對齊
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(360): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(361): error C2143: 語法錯誤 : 缺少“;”(在“&”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(361): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(361): error C2719: “Row”: 具有 __declspec(align('16')) 的形參將不被對齊
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(361): error C2719: “Column”: 具有 __declspec(align('16')) 的形參將不被對齊
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(361): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(361): error C2556: “int &_XMMATRIX::operator ()(UINT,UINT)”: 重載函數與“int _XMMATRIX::operator ()(UINT,UINT)”只是在返回類型上不同
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(360) : 參見“_XMMATRIX::operator ()”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(361): error C2040: “_XMMATRIX::operator ()”:“int &(UINT,UINT)”與“int (UINT,UINT)”的間接尋址級別不同
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(361): error C2059: 語法錯誤:“return”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(361): error C2238: 意外的標記位於“;”之前
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(363): error C2143: 語法錯誤 : 缺少“;”(在“&”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(363): error C2065: “CONST”: 未聲明的標識符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(363): error C2146: 語法錯誤: 缺少“)”(在標識符“_XMMATRIX”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(363): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(363): error C2059: 語法錯誤:“)”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(366): error C2065: “CONST”: 未聲明的標識符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(366): error C2146: 語法錯誤: 缺少“)”(在標識符“_XMMATRIX”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(366): error C2365: “operator *=”: 重定義;以前的定義是“函數”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(366): error C2059: 語法錯誤:“)”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(367): error C2065: “CONST”: 未聲明的標識符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(367): error C2146: 語法錯誤: 缺少“)”(在標識符“_XMMATRIX”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(367): error C2365: “operator *”: 重定義;以前的定義是“函數”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(367): error C2059: 語法錯誤:“)”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(372): error C2059: 語法錯誤:“}”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(372): error C2143: 語法錯誤 : 缺少“;”(在“}”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(372): error C2059: 語法錯誤:“}”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(378): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(378): error C2143: 語法錯誤 : 缺少“;”(在“&”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(378): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(378): error C2530: “CXMMATRIX”: 必須初始化引用
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(386): error C2146: 語法錯誤: 缺少“;”(在標識符“HALF”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(386): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(386): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(391): error C2146: 語法錯誤: 缺少“;”(在標識符“x”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(391): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(391): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(392): error C2146: 語法錯誤: 缺少“;”(在標識符“y”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(392): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(392): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(397): error C2061: 語法錯誤: 標識符“FLOAT”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(397): error C2535: “_XMFLOAT2::_XMFLOAT2(void)”: 已經定義或聲明成員函數
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(396) : 參見“_XMFLOAT2::_XMFLOAT2”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(398): error C2061: 語法錯誤: 標識符“CONST”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(398): error C2535: “_XMFLOAT2::_XMFLOAT2(void)”: 已經定義或聲明成員函數
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(396) : 參見“_XMFLOAT2::_XMFLOAT2”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(400): error C2061: 語法錯誤: 標識符“CONST”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(400): error C2805: 二進制“operator =”的參數太少
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(397): error C2065: “_x”: 未聲明的標識符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(397): error C2065: “_y”: 未聲明的標識符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(397): error C2614: “_XMFLOAT2”: 非法的成員初始化:“y”不是基或成員
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(397): error C2614: “_XMFLOAT2”: 非法的成員初始化:“x”不是基或成員
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(411): error C2061: 語法錯誤: 標識符“FLOAT”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(411): error C2535: “XMFLOAT2A::XMFLOAT2A(void)”: 已經定義或聲明成員函數
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(410) : 參見“XMFLOAT2A::XMFLOAT2A”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(412): error C2061: 語法錯誤: 標識符“CONST”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(412): error C2535: “XMFLOAT2A::XMFLOAT2A(void)”: 已經定義或聲明成員函數
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(410) : 參見“XMFLOAT2A::XMFLOAT2A”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(414): error C2061: 語法錯誤: 標識符“CONST”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(414): error C2805: 二進制“operator =”的參數太少
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(411): error C2065: “_x”: 未聲明的標識符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(411): error C2065: “_y”: 未聲明的標識符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(412): error C2065: “pArray”: 未聲明的標識符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(423): error C2146: 語法錯誤: 缺少“;”(在標識符“x”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(423): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(423): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(424): error C2146: 語法錯誤: 缺少“;”(在標識符“y”的前面)
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(424): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(424): error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(429): error C2061: 語法錯誤: 標識符“HALF”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(429): error C2535: “_XMHALF2::_XMHALF2(void)”: 已經定義或聲明成員函數
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(428) : 參見“_XMHALF2::_XMHALF2”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(430): error C2061: 語法錯誤: 標識符“CONST”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(430): error C2535: “_XMHALF2::_XMHALF2(void)”: 已經定義或聲明成員函數
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(428) : 參見“_XMHALF2::_XMHALF2”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(431): error C2061: 語法錯誤: 標識符“FLOAT”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(431): error C2535: “_XMHALF2::_XMHALF2(void)”: 已經定義或聲明成員函數
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(428) : 參見“_XMHALF2::_XMHALF2”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(432): error C2061: 語法錯誤: 標識符“CONST”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(432): error C2535: “_XMHALF2::_XMHALF2(void)”: 已經定義或聲明成員函數
1> d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(428) : 參見“_XMHALF2::_XMHALF2”的聲明
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(434): error C2061: 語法錯誤: 標識符“CONST”
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(434): error C2805: 二進制“operator =”的參數太少
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(429): error C2065: “_x”: 未聲明的標識符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(429): error C2065: “_y”: 未聲明的標識符
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(429): error C2614: “_XMHALF2”: 非法的成員初始化:“y”不是基或成員
1>d:\program files\microsoft directx sdk (june 2010)\include\xnamath.h(429): fatal error C1003: 錯誤計數超過 100;正在停止編譯
將 #include <xnamath.h>頭文件放到
#include <D3D11.h>
#include <d3dx11.h>
#include <DxErr.h>
#include <D3DCompiler.h> // for shader flags
的后面
d:\program files\microsoft directx sdk (june 2010)\include\dxerr.h(26): error C2146: 語法錯誤: 缺少“;”(在標識符“DXGetErrorStringA”的前面)
還是頭文件包含問題, 在 cpp 文件里使用了 DXTRACE_MSG() 宏( which 最終應該使用到 DXGetErrorStringA() 宏), cpp 只包含的頭文件 .h 只包含了 DxErr.h , DxErr.h 的相關宏及其他設置需要 整個 D3D11的預設值, 否則無法得到正確配置, 需要在 DxErr.h 包含前包含 D3D11.h 和 D3DX11.h ( 我不知道具體需要包含哪個, 干脆直接包含這兩個). 解決該問題的過程記錄:
1.使用 vs2010 開發, 編譯錯誤時, 一般只查看 "vs2010 > 錯誤列表", 並雙擊查看最終錯誤報告:
但這樣是不能直接找到的問題所在的, 嘗試了如下思路:
1. vs2010 中設置 本項目的 "VC++目錄" 中, D3D相關 Include 目錄沒有設置到 合理的優先位置: "包含目錄", "庫目錄", "鏈接器"的 "附加依賴項" 內 D3D 相關的走在最前面, 並且至少包含了 d3d11.h, d3dx11.h 和 dxerr.h
2.除了 dxerr.h 的報錯外, 還有 winnt.h winbase.h 的相關問題, 懷疑是不是 #include<windows.h> 和 #include <dxerr.h> 的問題:
即便調整 順序后, 還是不行.
3. 百度 > google > 全英文搜索, 呃, 沒有 找到.
以上這種查找 方式, 是因為 此前遇到過相似的 這些包含問題, 只要設置對就行了. 但這次不行.
4. DxGetErrorStringA() 報錯, 肯定是因為什么地方 使用到了 dxerr.h 的頭文件包含, 確定到 某個文件 使用了 DXTRACE_MSG() 調用( 因為當前項目只使用了 dxerr 的 該宏), 但有很多文件 使用了 DXTRACE_MSG() 到底是哪個? 如果能夠在 linux 使用 g++ 的makefile 能夠看到整個編譯詳細過程就好了, 在那里能夠具體看到 是在 編譯文件是出錯. 啊哈, 找到了 "vs2010 > 輸出" :
問題得以定位. 有兩點總結:
1. 開發 D3D11 時, 如果使用 dxerr.h 就應該盡量 包含 d3d11.h 和 d3dx11.h
2. 查找問題, 要確定好是在 編譯哪個 文件時出錯.
Draw() 出錯:
D3D11: WARNING: ID3D11DeviceContext::Draw: Input vertex slot 0 has stride 16 which is less than the minimum stride logically expected from the current Input Layout (20 bytes). This is OK, as hardware is perfectly capable of reading overlapping data. However the developer probably did not intend to make use of this behavior. [ EXECUTION WARNING #355: DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL ]
D3D11: WARNING: ID3D11DeviceContext::Draw: Vertex Buffer at the input vertex slot 0 is not big enough for what the Draw*() call expects to traverse. This is OK, as reading off the end of the Buffer is defined to return 0. However the developer probably did not intend to make use of this behavior. [ EXECUTION WARNING #356: DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL ]
情況一是, 圖形完全沒有任何東西渲染出來, 一個原因是 沒有設置好 vertex 數據 和 紋理對應數據.
情況二是, "WARNING" 僅僅是警告而已, 一個原因正如其描述的, 我傳遞的 stride 大小為16 小於 最小預期值, 原來代碼頂點描述為:
struct VertexPos{ XMFLOAT2 pos; XMFLOAT2 tex; };
sizeof( VertexPos) 就為 16, 改為
struct VertexPos{ XMFLOAT3 pos; XMFLOAT2 tex; };
后, 即可消除 WARNING, 第三位不用的話默認設置成 1.0f
“AF_IPX”: 宏重定義
Windows.H與WINSOCK2.H的包含關系,包含順序改為
#include <winsock2.h>
#include<windows.h>
即可. 如果還不行的話, 可采用 http://www.zachburlingame.com/2011/05/resolving-redefinition-errors-betwen-ws2def-h-and-winsock-h/ 的方法, 闖將最頂層的頭文件:
#ifndef _WINSOCK_WRAPPER_H_ #define _WINSOCK_WRAPPER_H_ #if _MSC_VER > 1000 #pragma once #endif #ifndef _WINDOWS_ #define WIN32_LEAN_AND_MEAN #include <windows.h> #undef WIN32_LEAN_AND_MEAN #endif #include <winsock2.h> #pragma comment(lib, "ws2_32.lib") #endif
模板 與 extern“C” 問題
在添加一個 c 實現的文件 到 cpp 項目時,出現如下報錯:
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: 語法錯誤: 標識符“acosf”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: 語法錯誤:“;”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: 語法錯誤: 標識符“asinf”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: 語法錯誤:“;”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2061: 語法錯誤: 標識符“atanf”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2059: 語法錯誤:“;”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2061: 語法錯誤: 標識符“atan2f”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2059: 語法錯誤:“;”
聽說一種解決方式是, 將 .c 文件修改為 .cpp
確實修改過后問題得以解決, 但出現新的問題:
1>d:\program files\microsoft visual studio 10.0\vc\include\xstddef(78): error C2894: 模板不能聲明為有“C”鏈接
1>d:\program files\microsoft visual studio 10.0\vc\include\xstddef(87): error C2894: 模板不能聲明為有“C”鏈接
1>d:\program files\microsoft visual studio 10.0\vc\include\xstddef(132): error C2894: 模板不能聲明為有“C”鏈接
1>d:\program files\microsoft visual studio 10.0\vc\include\xstddef(141): error C2894: 模板不能聲明為有“C”鏈接
這是因為在文件最開始位置使用了 extern “C”, 並在 evllib.h 使用了大量的模板
#ifdef __cplusplus extern "C" { #endif #include <stdlib.h> #include <EvlLib/evllib.h>
將模板相關的 頭文件移動到 extern “C” 前面即可。