SHGetFolderPath : undeclare identifier in vc++ 6.0 project

Sunny Thiyam 0 Reputation points
2023-03-27T11:21:44.0266667+00:00

I have VC++ 6.0 project and I use the below statement in the code

SHGetFolderPath(NULL, CSIDL_COMMON_DOCUMENTS , NULL, SHGFP_TYPE_CURRENT, szFolderPath);

While giving a build to solution, I found the below errors.

 'SHGetFolderPath' : undeclared identifier

 'CSIDL_COMMON_DOCUMENTS' : undeclared identifier

 'SHGFP_TYPE_CURRENT' : undeclared identifier

 

 Note: CV++ 6.0 is installed on windows 10 operating system.

 Kindly provide me solution for the above issue.

 Regards,

 Sunny

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,482 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,472 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 39,236 Reputation points
    2023-03-27T11:34:36.2266667+00:00

    It sounds like your code neglected to include the necessary header files that declare the function and related constants. The documentation at https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetfolderpatha mentions Shlobj.h and Shlobj_core.h