0

I'm trying to implement a c++ code with windows API in VS Code. But the extension available at vs code is not supporting API functions. The error is

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\KAVI-P~1\AppData\Local\Temp\ccZZwMdN.o:user.cpp:(.text+0x153): undefined reference to `NetUserEnum'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\KAVI-P~1\AppData\Local\Temp\ccZZwMdN.o:user.cpp:(.text+0x2bb): undefined reference to `NetApiBufferFree'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\KAVI-P~1\AppData\Local\Temp\ccZZwMdN.o:user.cpp:(.text+0x390): undefined reference to `NetUserGetInfo'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\KAVI-P~1\AppData\Local\Temp\ccZZwMdN.o:user.cpp:(.text+0x3b1): undefined reference to `NetApiBufferFree'
273K
  • 29,503
  • 10
  • 41
  • 64
  • 1
    Did you link with `Netapi32.lib` like the documentation tells you: [https://learn.microsoft.com/en-us/windows/win32/api/lmapibuf/nf-lmapibuf-netapibufferfree](https://learn.microsoft.com/en-us/windows/win32/api/lmapibuf/nf-lmapibuf-netapibufferfree) your bug is probably in your `tasks.json` – drescherjm Mar 23 '22 at 14:27
  • 2
    You should compile with `-lnetapi32`. – Wais Kamal Mar 23 '22 at 14:31

0 Answers0