在我從舊版 DirectX SDK 更改為 Windows SDK (Visual Studio 2015) 後,鏈接器一直在抱怨 (The linker keeps complaining after I changed from legacy DirectX SDK to Windows SDK (Visual Studio 2015)))


問題描述

在我從舊版 DirectX SDK 更改為 Windows SDK (Visual Studio 2015) 後,鏈接器一直在抱怨 (The linker keeps complaining after I changed from legacy DirectX SDK to Windows SDK (Visual Studio 2015)))

我剛剛刪除了包含在 DirectX SDK 中的所有標頭,然後我轉向了 Windows SDK,但是一旦我這樣做了,鏈接器就會不斷抱怨“未解析的外部符號”。鏈接器顯示大約 24 個錯誤,其中大部分錯誤是關於我什至沒有在我的遊戲中使用的函數。

鏈接器錯誤:error LNK2001: unresolved external symbol "union __m128 __vectorcall DirectX: :XMVectorMultiply(union __m128,union __m128)

error LNK2001: unresolved external symbol "union __m128 __vectorcall DirectX::XMVectorSubtract(union __m128,union __m128)

error LNK2001: unresolved external symbol "union __m128 __vectorcall DirectX::XMVector3Normalize(union __m128)<


參考解法

方法 1:

"Unresolved symbol" means that either you directly call these functions, or they are called by functions that you are calling. Functions that you call must either be defined by source code that you compile and link into your application, or they must be defined by libraries that you link into your application.

The DirectX Math library is completely defined in the header; there is no library to link against. Their definitions are in the various DirectX Math .inl files that are included by DirectXMath.h.

In other words, it's virtually impossible for you to include the header file declaring these functions and not get the implementation for them.

Since I am not at your computer, I can't tell you exactly what you did to cause this state of affairs. To determine the actual cause, you should simplify the problem to the smallest possible program that reproduces the problem, such as creating a new project that only includes DirectXMath.h and uses the function XMVectorMultiply to perform a vector multiplication and print the result.

Once you get that simple program working, then compare it to your program and look at the differences to find the source of your error.

This is the same process you go through when debugging an application at runtime, it's just that you're debugging your build instead of your application.

(by Soon_to_be_code_masterlegalize)

參考文件

  1. The linker keeps complaining after I changed from legacy DirectX SDK to Windows SDK (Visual Studio 2015)) (CC BY‑SA 2.5/3.0/4.0)

#direct3d11 #C++ #linker






相關問題

Адлюстраванне дынамічнага буфера ў Direct3D11 у праграме Windows Store (Mapping a dynamic buffer in Direct3D11 in a Windows Store App)

未處理的異常@ClearRenderTargetView() (Unhandled exception @ ClearRenderTargetView())

將 3d 模型導入 Direct3D 11 示例 (Importing 3d model to Direct3D 11 Example)

編譯器不允許我使用“DDSTextureLoader.h”和“WICTextureLoader.h” (Compiler won't let me use "DDSTextureLoader.h" and "WICTextureLoader.h")

在我從舊版 DirectX SDK 更改為 Windows SDK (Visual Studio 2015) 後,鏈接器一直在抱怨 (The linker keeps complaining after I changed from legacy DirectX SDK to Windows SDK (Visual Studio 2015)))

鏈接器給出了我在我的應用程序中根本沒有使用過的函數的錯誤 (Linker gives errors about a function that i have not used in my application at all)

Direct3D 11 中輸出圖像的雙線性過濾 (Bilinear filtering of output image in Direct3D 11)

Direct3D 編程新手:11 與 12 (New to Direct3D programming: 11 vs 12)

如何在 Direct3D 11 上使用字體文件渲染文本? (How can I render text using font files on Direct3D 11?)

獲取 D3D 調試信息? (Get D3D debug information?)

為什麼 XMMatrixLookAtLH 會導致調試錯誤? (Why does XMMatrixLookAtLH result in a debug error?)

InterlockedAdd HLSL 潛在優化 (InterlockedAdd HLSL potential optimization)







留言討論