Thread: SHCreateDirectory: identifier not found

  1. #1
    Pawn, Pascal and C++
    Join Date
    Sep 2005
    Posts
    90

    SHCreateDirectory: identifier not found

    Could someone help me with this error I get when I compile?
    This isn't really my code, so I got no idea how to fix it.
    Thanks.

    Code:
    error C3861: 'SHCreateDirectory': identifier not found
    Code:
    #include <windows.h>
    #include <shlobj.h> 
    
    void ConvertStringToWChar (LPCTSTR str, WCHAR *buffer)
    {
    	   int		i;
    
           for(i=0; str[i]; i++)
                 buffer[i] = (WCHAR)str[i];
    
           buffer[i] = 0;
    }
    
    void CreatePath(const char *fname)
    {
    	int		i;
    	char	path[MAX_PATH];
    	WCHAR	buffer[MAX_PATH];
    	
    
    	strcpy(path,fname);
    
    	i=strlen(path);
    
    	while(path[i]!='\\'&&i>0)
    		i--;
    
    	path[i]=0;
    
    	ConvertStringToWChar(path, buffer);
    	SHCreateDirectory(NULL, buffer);
    }

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Take a look here. Particularly at the remarks section:

    http://msdn2.microsoft.com/en-us/library/ms647696.aspx
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Pawn, Pascal and C++
    Join Date
    Sep 2005
    Posts
    90
    I do have Windows XP SP2.

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    hmm... do you have the Microsoft Platform SDK installed? This assuming you are using Microsoft Visual Studio 2005 Express edition?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Pawn, Pascal and C++
    Join Date
    Sep 2005
    Posts
    90
    I got Visual Studio 2005 Express, indeed.
    I downloaded the SDK and copied over the include files?

  6. #6
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Can't help any further mate. Sorry.
    Someone else will, i'm sure.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #7
    Pawn, Pascal and C++
    Join Date
    Sep 2005
    Posts
    90
    So copying over the include files was correct?
    I wasn't really sure what to do there.

  8. #8
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Err... my ears perked. Didn't pay much attention to that remark on your previous post.
    No. I don't remember having to do that. You just download the SDK and install it. No file fiddling here.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #9
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  10. #10
    Pawn, Pascal and C++
    Join Date
    Sep 2005
    Posts
    90
    I have pretty much done what that page says. =/

  11. #11
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Is the project linked to the library?

    shell32.lib
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  12. #12
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Location
    Tijuana, BC, México
    Posts
    310
    See this.
    Why not use the old CreateDirectory.
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

  13. #13
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    There is no SHCreateDirectory in newer SDK versions. But there IS an SHCreateDirectoryEx function. Try that.
    Last edited by maxorator; 07-31-2007 at 01:04 AM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 07-19-2007, 12:29 AM
  2. arrays with elements
    By bradleyd in forum C Programming
    Replies: 5
    Last Post: 04-10-2007, 12:00 PM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 09:23 PM
  5. error: identifier "byte" is undefined.
    By Hulag in forum C++ Programming
    Replies: 4
    Last Post: 12-10-2003, 05:46 PM