4

当我尝试编译以下内容时:

#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”的未定义引用

当然,这对我来说有些愚蠢,但是有人可以告诉我我在这里缺少什么吗?

4

1 回答 1

5

您需要添加 shlwapi 库进行链接:

gcc -o test test.c -lshlwapi

为我工作

于 2009-03-08T08:30:34.563 回答