Question

Lorsque j'essaie de compiler ce qui suit:

#include <windows.h>
#include <shlwapi.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
  char firstPart[MAX_PATH] = "c:\\windows";
  char secondPart[MAX_PATH] = "system32";
  PathAppend(firstPart, secondPart);

  return 0;
}

Utilisation de la commande:

c:\mingw\bin\gcc -mwindows -mno-cygwin -o test test.c

Il échoue avec l'erreur suivante:

  

référence indéfinie à `` _imp__PathAppendA @ 8'`

C'est sûrement une stupidité de ma part, mais quelqu'un peut-il me dire ce que je manque ici?

Était-ce utile?

La solution

Vous devez ajouter la bibliothèque shlwapi pour la liaison:

gcc -o test test.c -lshlwapi

Fonctionne pour moi

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top