GetDllDirectory() isn't recognized!?!?
GetDllDirectory() isn't recognized!?!?
(OP)
I hate it when Visual Studio does this to me...
I'm trying to use GetDllDirectory() in my MFC DLL app.
I have this code in my function:
When I compile it, I get this compile error:
I added the SDK include and lib directories to my project settings.
I tried including <windows.h> and even <winbase.h> but no luck.
If I add this function declaration to my code (copied from <winbase.h>:
I get this link error:
If I try using the GetCurrentDirectory() function right above it in <winbase.h> it compiles and links with no problem.
Why does Visual Studio hate me?
I'm trying to use GetDllDirectory() in my MFC DLL app.
I have this code in my function:
CODE
char dllDir[MAX_PATH];
DWORD ret = GetDllDirectoryA( (DWORD)MAX_PATH, (LPSTR)dllDir );
DWORD ret = GetDllDirectoryA( (DWORD)MAX_PATH, (LPSTR)dllDir );
CODE
error C3861: 'GetDllDirectoryA': identifier not found, even with argument-dependent lookup
I tried including <windows.h> and even <winbase.h> but no luck.
If I add this function declaration to my code (copied from <winbase.h>:
CODE
WINBASEAPI
DWORD
WINAPI
GetDllDirectoryA(
IN DWORD nBufferLength,
OUT LPSTR lpBuffer
);
DWORD
WINAPI
GetDllDirectoryA(
IN DWORD nBufferLength,
OUT LPSTR lpBuffer
);
CODE
error LNK2019: unresolved external symbol "__declspec(dllimport) unsigned long __stdcall GetDllDirectoryA(unsigned long,char *)"
If I try using the GetCurrentDirectory() function right above it in <winbase.h> it compiles and links with no problem.
Why does Visual Studio hate me?

RE: GetDllDirectory() isn't recognized!?!?
I guess it helps to read the entire page in MSDN instead of skimming through it.
I needed to define some Windows preprocessor variables to a higher number:
http