rsk82
rsk82

Reputation: 29397

error with PathFindFileName when compiling under mingw

code:

#include <shlwapi.h>
int main() {
  TCHAR buffer[MAX_PATH];
  DWORD bufSize;
  GetModuleFileName(NULL, buffer, bufSize);
  TCHAR* out = PathFindFileName(buffer);
}

error message:

ccQzTh4t.o:pathfind.cpp:(.text.startup+0x40): undefined reference to `_imp__PathFindFileNameA@4'
collect2: ld returned 1 exit status

Maybe I forgot some includes ?

Upvotes: 2

Views: 3233

Answers (1)

K-ballo
K-ballo

Reputation: 81379

PathFindFileName is part of the Shlwapi.lib library, you need to link against it.

Upvotes: 3

Related Questions