SHGetFolderPath undeclared identifier

This is a discussion on SHGetFolderPath undeclared identifier within the Windows Programming forums, part of the Platform Specific Boards category; I am having some difficulty getting the path to a users 'My Documents'. I have tried several ways but this ...

  1. #1
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396

    SHGetFolderPath undeclared identifier

    I am having some difficulty getting the path to a users 'My Documents'. I have tried several ways but this seems to be the closest to succeeding (only 1 error.) I assumed that I had included the correct headers but I get an undeclared identifier. I would greatly appreciate some help to get me back on track.

    Code:
    	char * szPath[MAX_PATH];
    	// From MSDN
    	// CSIDL_PERSONAL  or  L"::{450d8fba-ad25-11d0-98a8-0800361b1103}"
    	if (( SHGetFolderPath( hwnd, CSIDL_PERSONAL , NULL, 0, szPath ) ) )
    	{
    		// do something usefull...
    	}
    error C2065: 'SHGetFolderPath' : undeclared identifier
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    #define _WIN32_IE 0x0500 (0x0400 for MinGW) prior to #including shlobj.h

    If you still get the same error you are probably using msvc6 out of the box and should get the latest platform sdk from microsoft.

    For future reference it's always useful with 'undeclared identifier' errors to search the relevant header file for the function in question, firstly to ensure it is actually declared and secondly to see if any preprocessor conditionals are required to use it.

    Hope that helps.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Thank you for the reply Ken. I will file this away for future reference I appreciate the educational reply.
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  3. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 09:23 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21