mingw linker no puede encontrar PathAppend
Pregunta
Cuando intento compilar lo siguiente:
#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 el comando:
c:\mingw\bin\gcc -mwindows -mno-cygwin -o test test.c
Falla con el error:
referencia no definida a `` _imp__PathAppendA @ 8'`
Seguramente esto es una estupidez de mi parte, pero ¿puede alguien decirme lo que me estoy perdiendo aquí?
Solución
Debe agregar la biblioteca shlwapi para vincular:
gcc -o test test.c -lshlwapi
Funciona para mí
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow