开发者

Undefined reference to NetWkstaUserGetInfo in Qt but works in VS

开发者 https://www.devze.com 2023-03-25 05:07 出处:网络
My project is implemented in Qt 4.7, and now I wa开发者_C百科nt to retrieve some windows log in information. So I am dabbling around and found this code from MSDN ( http://msdn.microsoft.com/en-us/lib

My project is implemented in Qt 4.7, and now I wa开发者_C百科nt to retrieve some windows log in information. So I am dabbling around and found this code from MSDN ( http://msdn.microsoft.com/en-us/library/aa370670(v=vs.85).aspx ).

Copying and pasting this code in Visual Studio works perfectly however using it in Qt gives the error "Undefined reference to 'NetWkstaUserGetInfo@12'" !

What surprises me, Qt does autocomplete and recognize NetWkstaUserGetInfo, and it also tells about the input parameters, but then when compiled it gives the undefined error !

Kindly asking, may you please advise me in this regard,


You need to link with netapi32.lib.

See this MSDN example and pay attention to

pragma comment(lib, "netapi32.lib")

in the code.

0

精彩评论

暂无评论...
验证码 换一张
取 消