I am trying to use the GetUserNameEx function, and my code compiles, but when I build it, I get this error:
Cpp1.obj : error LNK2001: unresolved external symbol "unsigned char __stdcall GetUserNameExA(enum EXTENDED_NAME_FORMAT,char *,unsigned long *)" (?GetUserNameExA@@YGEW4EXTENDED_NAME_FORMAT@@PADPA K@Z)
Release/Cpp1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Am I missing a library?
Does anyone have any suggestions?
It seems like you are using an unsigned variable and you can't. Are you? Try giving it a value right away and then it will be overwritten later.
On MSDN it states you have to link with Secur32.lib, have you added this library? Also it's only for nt/2k etc not 9x.
Thank you for the tips.
I see what you mean about the Secur32.lib.
How do I link to it? Is it included in the
You just add "Secur32.lib" to the Object/Library Modules edit box on the link tab of the Project Settings. This library appears to be a fairly recent addition to the API so you may need an updated Platform SDK from the MS site if Secur32.lib isn't in your standard lib directory.
I just downloaded the SDK and got secur32.lib.
I added it into my \lib directory, but I am still getting the same error as before. Any more ideas?
I just tried it and it linked fine. Have you linked to Secur32.lib in your project settings?
Thanks for all of your help!
I finally got it to work...
I included too many header files.
The one that was causing the problem was SSPI.H