Search code examples
cwinapicomlinker-errorsdirect3d

d3d10 C interface not available


I am porting an application from D3D7 to D3D10. Even though the C interface for D3D10 exists, It does not seem to be visible when compiling/linking. The D3D7 version uses the C interface and I do not see anything different.

Here are my build commands for the D3D10 file: "arguments": ["D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX64\\x86\\cl.exe", "/c", "/nologo", "/Zi", "/FS", "/Fdbuild\\windows\\x86\\debug\\compile.trng2.pdb", "/W3", "/Od", "/std:c11", "/MTd", "/Isrc", "/DXAUDIO2_HELPER_FUNCTIONS", "/DWIN32_LEAN_AND_MEAN", "/DNOMINMAX", "/D_CRT_SECURE_NO_WARNINGS", "/DCINTERFACE", "/DDO_LOG", "/D_DEBUG", "/D_USE_MATH_DEFINES", "/IE:\\REDACTED\\build\\.packages\\z\\zlib\\v1.3.1\\55fd28c48bc34b35b89c569e2dd7bcce\\include", "/IE:\\REDACTED\\build\\.packages\\x\\xaudio2redist\\1.2.11\\163bc5c6e48e49d98ea66f724aede6bf\\include", "/Fobuild\\.objs\\REDACTED\\windows\\x86\\debug\\REDACTED\\specific\\d3d10\\d3d10info.c.obj", "REDACTED\\specific\\d3d10\\d3d10info.c"],

As you can see, I am specifying C11 as well as CINTERFACE, but i receive linker errors and a compiler warning.

d3d10info.c(18): warning C4013: 'IDXGIFactory_EnumAdapters' undefined; assuming extern returning int

d3d10info.c.obj : error LNK2019: unresolved external symbol _IDXGIFactory_EnumAdapters referenced in function _EnumAdapters


Solution

  • You need to also define COBJMACROS to expose the convenience macros like IDXGIFactory_EnumAdapters(factory,int,void**)
    This is not needed for d3d.h (D3D < 9), but seems to be needed for d3d10.h