Linking Errors & Cannot Open File

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Linking Errors & Cannot Open File

      The Error Message:

      1>------ Build started: Project: Ursa Major, Configuration: Debug Win32 ------
      1>LINK : fatal error LNK1104: cannot open file 'd3dx11.lib'
      ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

      Things I have checked: (VC++ Express 2010)

      Project Properties (with Expert Settings selected):
      - In Config Settings - VC++ Directories
      ---The Include Dir and Lib Dir for the DirectX SDK are linked

      - In Linker - Input - Additional Dependencies
      ---d3d11.lib d3dx11.lib d3dcompiler.lib are there

      Anyone know of something else I can check?
    • Try removing d3dx11.lib and just linking something else in that directory, like d3d11.lib. Does it work? If so, that would be very strange. Does the build log file give you any information?

      -Rez
    • I'm guessing the link order is non-determinisitc. If you can't link other libs, it sounds like the directories aren't set up correctly.

      -Rez
    • Here is the log file:

      Build started 4/18/2012 12:11:52 PM.
      1>Project "F:\Personal_BackUps\Game Development\VC++ Projects\Ursa Major\Ursa Major\Ursa Major.vcxproj" on node 2 (build target(s)).
      1>InitializeBuildStatus:
      Touching "Debug\Ursa Major.unsuccessfulbuild".
      ClCompile:
      All outputs are up-to-date.
      c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _WINDOWS /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yu"StdAfx.h" /Fp"Debug\Ursa Major.pch" /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt "Ursa Major.cpp"
      Ursa Major.cpp
      ResourceCompile:
      All outputs are up-to-date.
      ManifestResourceCompile:
      All outputs are up-to-date.
      Link:
      c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"F:\Personal_BackUps\Game Development\VC++ Projects\Ursa Major\Debug\Ursa Major.exe" /INCREMENTAL /NOLOGO d3d11.lib d3dcompiler.lib d3dx11d.lib d3dx9d.lib dxerr.lib /MANIFEST /ManifestFile:"Debug\Ursa Major.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"F:\Personal_BackUps\Game Development\VC++ Projects\Ursa Major\Debug\Ursa Major.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"F:\Personal_BackUps\Game Development\VC++ Projects\Ursa Major\Debug\Ursa Major.lib" /MACHINE:X86 "Debug\Ursa Major.res"
      "Debug\Ursa Major.exe.embed.manifest.res"
      Debug\stdafx.obj
      "Debug\Ursa Major.obj"
      1>LINK : fatal error LNK1104: cannot open file 'd3dcompiler.lib'
      1>Done Building Project "F:\Personal_BackUps\Game Development\VC++ Projects\Ursa Major\Ursa Major\Ursa Major.vcxproj" (build target(s)) -- FAILED.

      Build FAILED.

      I think the DirectX SDKs are linked correctly because other project that use them work fine.
    • It doesn't matter if other projects can link to them because each project can have its own settings. The include paths are set up correctly or else you wouldn't even make it to the link stage. Hmm. Where are you applying the linker path? Where exactly is DirectX installed? Are you linking directly to d3dcompiler.lib or that is a dependency from somewhere else?

      -Rez
    • Ahh, the lib directory is wrong. You want:
      C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86

      Notice the x86 directory there. They split the 32-bit and 64-bit libs.

      -Rez
    • After fixing that problem I got more linker error messages that I thought I could fix but am having problems again. The new errors are:

      1>------ Build started: Project: Ursa Major, Configuration: Debug Win32 ------
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageW@4 referenced in function _wWinMain@16
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _wWinMain@16
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__TranslateAcceleratorW@12 referenced in function _wWinMain@16
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__GetMessageW@16 referenced in function _wWinMain@16
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__LoadAcceleratorsW@8 referenced in function _wWinMain@16
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__LoadStringW@16 referenced in function _wWinMain@16
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExW@4 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__LoadCursorW@8 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__LoadIconW@8 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__UpdateWindow@4 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExW@48 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__AdjustWindowRect@12 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__GetRawInputData@20 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__EndPaint@8 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__BeginPaint@8 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcW@16 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__DialogBoxParamW@20 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__RegisterRawInputDevices@12 referenced in function "bool __cdecl InitRawInput(void)" (?InitRawInput@@YA_NXZ)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__MessageBoxW@16 referenced in function "long __cdecl InitDevice(void)" (?InitDevice@@YAJXZ)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__GetClientRect@8 referenced in function "long __cdecl InitDevice(void)" (?InitDevice@@YAJXZ)
      1>Ursa Major.obj : error LNK2019: unresolved external symbol __imp__EndDialog@8 referenced in function "int __stdcall About(struct HWND__ *,unsigned int,unsigned int,long)" (?About@@YGHPAUHWND__@@IIJ@Z)
      1>F:\Personal_BackUps\Game Development\VC++ Projects\Ursa Major\Debug\Ursa Major.exe : fatal error LNK1120: 24 unresolved externals
      ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

      A lot of these functions are part of the 'WinUser.h,' or 'windows.h' header files. Why would the compiler be having problems with windows files?

      I check on the MSDN site and it said to use 'extern' or function inlining. If these were errors for a class that I had written I could understand, but windows stuff?

      The post was edited 1 time, last by Roster ().

    • This looks like stuff from User32.lib. Are you linking that in? If you go to your linker input settings and open the expanded dialog, you should see all libs that are getting linked, including ones inherited from other property sheets. These inherited libs are where you typically find things like User32.lib along with kernal32.lib, gdi32.lib, etc. Make sure it's in there. Also make sure that "Inherit from parent or project defaults" is checked.

      -Rez