Search code examples
cvisual-c++mingw-w64

Determine libraries to link against for a windows library function?


When I find the functions I want in say AD Domain Services

https://learn.microsoft.com/en-us/windows/win32/api/_ad/

it helpfully tells me which headers I need, but not which libraries I need to link in.

How do I determine the libraries? I guess there must be something in the header file, but I don't see it.

The project is mingw based, so can't use whatever magic the M/S compiler would be using.


Solution

  • If you click on things that need libraries linked, like the functions on that documentation page, e.g. AddForms, the documentation contains a neat little table showing you OS requirements, header, and library you need to link:

    Requirement                 Value
    Minimum supported client    Windows Vista
    Minimum supported server    Windows Server 2008
    Target Platform             Windows
    Header                      cmnquery.h
    Library                     Uuid.lib
    DLL                         Dsquery.dll