Undefined reference to 'GetConsoleWindow' but _WIN32_WINNT and NTDDI_WIN7 defined : I am trying to get a handle for a consoleWindow the following:

    #include <Windows.h>
    #include <stdio.h>
    #include <stdlib.h>

    #define NTDDI_WIN7 as 0x06010000
    #define _WIN32_WINNT as 0x0500

    int main(int argc, char *argv[]) {
        HWND self = GetConsoleWindow();
        someMoreCode...
    }

I followed instructions from [microsoft][1] and [microsoftheaders][2], but I still get:

> undefined reference to `GetConsoleWindow'


    


  [1]: https://docs.microsoft.com/en-us/windows/console/getconsolewindow
  [2]: https://msdn.microsoft.com/library/windows/desktop/aa383745