1
votes

I am using "RegSetKeyValue" API in my application. I am referring to http://msdn.microsoft.com/en-us/library/ms724921(VS.85).aspx.

As told in the article, I have defined _WIN32_WINNT_ as 0x0600 and have included Advapi32.lib in my linker options.

But still I am getting linker error, "unresolved external symbol _RegSetKeyValue". Please tell me what I am missing here.

Here is my code snippet.

#define _WIN32_WINNT  (0x0600)

#include <windows.h>

int main()
{
    LONG status;

    status = RegSetKeyValue( HKEY_LOCAL_MACHINE,
                             "SOFTWARE\\7-Zip",
                             "path",
                             REG_SZ,
                             "C:\\newfolder\\path",
                             strlen("C:\\chethan\\path")+1);
    return 0;
}

PS: I am using VC++ 6.0 for this (even tried on Visual studio 2005, same error there too!).

1

1 Answers

2
votes

The Advapi32.lib that your linker is using might be too old - this API was introduced with Vista. Make sure the linker is using a .lib from Vista SDK or newer.