mingw vinculador não consegue encontrar PathAppend
Pergunta
Quando tento compilar o seguinte:
#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;
}
Usando o comando:
c:\mingw\bin\gcc -mwindows -mno-cygwin -o test test.c
Ele falha com o erro:
undefined reference to `` _imp__PathAppendA @ 8'`
Com certeza esta é uma estupidez da minha parte, mas alguém pode me dizer o que eu sinto falta aqui?
Solução
Você precisa adicionar a biblioteca shlwapi para ligar:
gcc -o test test.c -lshlwapi
Obras para me
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow