未解决的外部错误(d3d)

时间:2015-09-11 04:02:32

标签: direct3d unresolved-external d3dx

我什么时候尝试执行此代码

D3DXCreateFont(d3dDevice, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET,
    OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
    choiceFont, &Font);

我收到此错误

Error   1   error LNK2019: unresolved external symbol _D3DXCreateFontA@48 referenced in function "public: void __thiscall BlackBox::CreateFontA(struct IDirect3DDevice9 *,char const *)" (?CreateFontA@BlackBox@@QAEXPAUIDirect3DDevice9@@PBD@Z)    D:\Projects\Black_Box\Black_Box\BlackBox.obj    Black_Box

1 个答案:

答案 0 :(得分:0)

您需要与旧版DirectX SDK中的d3dx9.lib相关联才能获得D3DXCreateFont。这在MSDN上注明。

如果您的输入中列出了此库,那么您的问题可能是您错误地配置了链接库路径。对于VS 2010,2012,2013或2015,您必须手动将旧版DirectX SDK路径添加到项目中(VC ++目录):

对于使用Windows 7.x SDK或VS 2012/2013/2015的“Windows XP兼容”平台工具集的VS 2010,您首先列出DirectX SDK路径 - 有关详细信息,请参阅this post

  • Win32 / x86(32位)

    • $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)
    • $(DXSDK_DIR)Include;$(IncludePath)
    • $(DXSDK_DIR)Include;$(IncludePath)
  • x64 native

    • $(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)
    • $(DXSDK_DIR)Include;$(IncludePath)
    • $(DXSDK_DIR)Lib\x64;$(LibraryPath)

对于通过props使用Windows 8.x SDK的VS 2012,2013,2015或VS 2010,您可以列出第二个DirectX SDK路径 - 有关详细信息,请参阅Where is the DirectX SDK?

  • Win32 / x86(32位)

    • $(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x86
    • $(IncludePath);$(DXSDK_DIR)Include
    • $(LibraryPath);$(DXSDK_DIR)Lib\x86
  • x64 native

    • $(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86
    • $(IncludePath);$(DXSDK_DIR)Include
    • $(LibraryPath);$(DXSDK_DIR)Lib\x64