I am using the SHGetSpecialFolderPath
function of the WINAPI, and also using the windows VisualExpressC++ compiler (cl.exe) to compile it. But when in linking stage I get this error:
error LNK2019: unresolved external symbol __imp___SHGetSpecialFolderPathA@16 referenced in function _main
I guess that I need to link Shell32.lib
, is this correct and how would I do it in a way that I can actually get my program running on another system, maybe even a XP instead of a 7, without recompiling it?
If you're compiling from the command line, just add shell32.lib
to the command, something like this:
cl file1.cpp file2.cpp shell32.lib
You're just using a function that Windows provides. Since this particular function goes back almost to the dawn of time (Windows 95, if I recall correctly), you shouldn't have to do anything special to use it on anything reasonably current.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With