0

I'm on Qt in C++. I want to use library ADsGetObject https://learn.microsoft.com/en-us/windows/win32/api/adshlp/nf-adshlp-adsgetobject

At compilation, I have an error due to a link problem in the library.

In a .pro I have

INCLUDEPATH += $$PWD/Windows/include
LIBS +=-L"C:/Windows" -lwintrust -lActiveds

And the error message is : external symbol not resolved IID_IDirectoryObject

Has anyone ever had this problem?

  • 1
    the *.lib file is in the Windows SDK folder, not in C:\Windows – PeterT Jul 02 '19 at 16:45
  • @PeterT for other libraries it worked (ex: -lwintrust -lnetapi32...) and the path to the library is C:\\Windows... Is it the right library to include ? –  Jul 03 '19 at 06:41
  • Microsoft likes to make things sort of complicated. Most of the final *.dll files are in C:\Windows\System32 (or C:\Windows\SysWoW64 for 32-bit stuff). HOWEVER, this is not like in unix-land where you normally just link against the *.so directly. You're supposed to link against the ["import libraries"](https://en.wikipedia.org/wiki/Dynamic-link_library#Import_libraries): the *.lib files that come with the windows SDK (e.g. in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64 ). – PeterT Jul 03 '19 at 06:57
  • 1
    also wintrust and netapi32 are way older, maybe you're using an old SDK. Activeds is Vista and newer only – PeterT Jul 03 '19 at 07:16
  • I use SDK 10.0.18362.1 and the compiler is MSVC –  Jul 03 '19 at 09:45
  • Then try to look if the *.lib file is in `C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.1\um\x64` or whereever you installed it and add that path to library search path – PeterT Jul 03 '19 at 09:49
  • I add an a .pro : LIBS += L"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\arm64\ActiveDS.lib" but there is an error message "Impossible to open the file" –  Jul 03 '19 at 11:18
  • Might just be qmake messing with the backslashes, either make them double backslashes or make them forward slashes – PeterT Jul 03 '19 at 11:25
  • @PeterT I found the solution LIBS +=-L"path_sdk\\10\\Lib\\" -lADSIid -lActiveDS –  Jul 03 '19 at 11:34

0 Answers0