GetProfilesDirectory()

Anyone here has had any experience with the aforementioned function included inside Userenv.h?

1
2
3
	char userData[50];
	DWORD userDataSize = 50;
	GetProfilesDirectory(userData,&userDataSize); 


Thats my code, but for some reason it gives away this error:

error LNK2019: unresolved external symbol __imp__GetProfilesDirectoryA@8
closed account (S6k9GNh0)
The good thing about VC++ is that all of there errors are marked by an unique ID. For this error you have error: LNK2019, which means that you have error 2019 inside of the Linker system. You can google the whole word or you may look on the MSDN Developer site to research. If you still don't understand and can't find a solution, you may ask for more help.

http://msdn.microsoft.com/en-us/library/799kze2z(VS.80).aspx
You already know what LNK2019 means because it the linker gives you the error message: Unresolved external symbol.

You need to add the static library userenv.lib to your project as stated by the MSDN page here: http://msdn.microsoft.com/en-us/library/bb762278(VS.85).aspx

Notice at the bottom of the page there is a table titled Function Information which tells you which library the function is defined in.

I'm not in front of a VC++ compiler at the moment but IIRC you can add the library by going to your project settings, under Linker->Input->Additional Dependencies and adding userenv.lib to the list

Edit: spelling
Edit: I presumed you are using VC2005 or upwards IDE. If not, please repost
Last edited on
Indeed, am using VC2005 !
Thanks~!!!

Topic archived. No new replies allowed.