当我尝试编译以下内容时:
#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;
}
使用命令:
c:\mingw\bin\gcc -mwindows -mno-cygwin -o test test.c
它失败并出现错误:
对“_imp__PathAppendA@8”的未定义引用
当然,这对我来说有些愚蠢,但是有人可以告诉我我在这里错过了什么吗?
您需要添加 shlwapi 库进行链接:
gcc -o test test.c -lshlwapi
对我有用
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)