Is the IADs interface missing in activeds.dll, or ?

  • Hello all

    I¨m trying to use the AD interface IADs to administer user accounts
    Include headers:

    #include "activeds.h" // should suffice

    In body:

    IADs *pObject = NULL;
    HRESULT hr = ADsOpenObject(L"LDAP://rootDSE", NULL, NULL, ADS_SECURE_AUTHENTICATION, IID_IADs, (void**)&pObject);

    The compiler finds all the symbols in use.
    In .pro file, to lo link with activeds.dll:

    LIBS += -Lc:\Windows\System32\activeds.dll

    The linker gives two warnings:

    Undefined reference to 'IID_IADs'
    undefined reference to 'AdsOpenObject@24

    Here the decoration @24 is clearly a problem. Found usung shell32 solved this one:
    LIBS += -Lshell32 c:\Windows\System32\activeds.dll
    The linker gives only one warnings:

    Undefined reference to 'IID_IADs'

    Where is IID_IADs?

    Oviously I'm doing something wrong here, but what?
    Best regards

  • Moderators

    You should not try to link to the dll. You should link to a lib that will load and resolve the entry points from the dll at runtime.
    The syntax for that is LIBS += -L<Path to the lib file> -l<name of the lib without the extension>

    So instead of

    LIBS += -Lc:\Windows\System32\activeds.dll

    you should have something like this:

    LIBS += -L"c:/Program Files (x86)/Windows Kits/10/Lib/10.0.15063.0/um/x64/" -lActiveds

    Of course substitute the path to the Windows SDK you use.
    Don't forget to re-run qmake after you modify the .pro file. (menu Build -> Run qmake)

    For the compilation error about undefined reference change IID_IADs to __uuidof(IADs). The former is just a define around that.
    @24 decoration is not a problem. This is just a name mangling scheme.

  • Thank you for helping, Chris.
    Unfortunately, my QT library do not have the requested .lib file nor do my windows 7 version. I will try do download the file, if possible.


  • Moderators

    Unfortunately, my QT library do not have the requested .lib file nor do my windows 7 version. I will try do download the file, if possible.

    This is not distributed with Qt nor with Windows. You need to get a Windows SDK to develop for Windows APIs.
    Don't try to download that single file from somewhere. You'll just get mallware. Download and install proper Windows SDK from Microsoft's site.

  • Ok, I'll try that. Thanks again.


  • Sorry to bother you people, but
    I have now installed Windows SDK and are linking with the static library ActiveDS.Lib. This did not resolve the problem. A little morre surfing revealed that i need ADSIid.Lib to remedy this. so I added this file too, found in the same directory.

    From the .pro file:
    LIBS += -L"c:\Programfiler\Microsoft SDKs\Windows\v7.1\Lib" -lADSIid
    LIBS += -L"c:\Programfiler\Microsoft SDKs\Windows\v7.1\Lib" -lActiveDS

    From the makefile:
    LIBS = -L"c:\Programfiler\Microsoft SDKs\Windows\v7.1\Lib" -lADSIid -lActiveDS -LC:\Qt\5.9\mingw53_32\lib ..etc.

    Linker now reports:
    "cannot find -lADSIid" (I did a copy/paste of the name)

    For shure this wasn't easy.


  • Moderators

    \ is an escape character so you can't use it like that in paths. either use / or escaped sequence \\.
    Also you don't have to specify the path every time and you can combine multiple linker inputs in one line so

    LIBS += -L"c:/Programfiler/Microsoft SDKs/Windows/v7.1/Lib" -lADSIid -lActiveDS


    LIBS += -L"c:\\Programfiler\\Microsoft SDKs\\Windows\\v7.1\\Lib" -lADSIid -lActiveDS

  • Hi Chris

    This is the makefile without my libraries:
    LIBS = -LC:\Qt\5.9\mingw53_32\lib C:\Qt\5.9\mingw53_32\lib\libQt5Multimediad.a ... etc.
    This is my .pro file:
    LIBS += -L"c:/Programfiler/Microsoft SDKs/Windows/v7.1/Lib" -lADSIid
    LIBS += -L"c:/Programfiler/Microsoft SDKs/Windows/v7.1/Lib" -lActiveDS
    This is the makefile with my libraries:
    LIBS = -L"c:\Programfiler\Microsoft SDKs\Windows\v7.1\Lib" -lADSIid -lActiveDS -LC:\Qt\5.9\mingw53_32\lib ... etc.

    as you can see this didn't help. Weird


  • Moderators

    Ah, sorry, my bad. I wrongly assumed you're using MSVC as the compiler, but apparently you're using MinGW.

    You can't use the regular Windows SDK with it. It's not compatible.

    MinGW has its own set of headers and libs for winapi (usually somewhat behind the current SDK). To use it it should be enough to do LIBS += -lADSIid -lActiveDS without any paths, but, unfortunately, the MinGW package distributed with Qt doesn't seem to have the ADSIid library file. It's either merged into another lib or just not implemented in MinGW. You'll have to check with MinGW's documentation which is it.

  • Ok. Then i know what the problem is. I'll close this thread and try to re-formulate the question.

    Thank's again, Chris


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.