mingw链接器找不到PathAppend [英] mingw linker can't find PathAppend

查看:97
本文介绍了mingw链接器找不到PathAppend的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I try to compile the following:

#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

失败,并显示以下错误:

It fails with the error:

对``_imp__PathAppendA @ 8''的未定义引用

undefined reference to ``_imp__PathAppendA@8'`

这当然是我的愚蠢,但是有人可以告诉我我在这里想念的东西吗?

Surely this is some stupidity on my part, but can someone tell me what I'm missing here?

推荐答案

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

You need to add the shlwapi library for linking:

gcc -o test test.c -lshlwapi

为我工作

这篇关于mingw链接器找不到PathAppend的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆