rt,沿着LineTo方法进来发现几乎所有wingdi.h底下的方法都找不到定义

本人不怎么会用VSCode,在把文件夹整理之后重新配置vscode环境,有一个程序包含了windows头文件,使用了MoveToEx,LineTo,TextOut,SetTextAlign等方法,运行发现报错undefined reference to `XXX'错误

有考虑过添加编译项目-lgdi32,在compilerArgs内添加过了好像还是不行

vscode版本

是用window11 64位系统
具体的tasks配置

我单独把wingdi库内的函数写在一个程序里面也是不行,windows内其他库倒是可以用
//==================================================================================================
// window text.cpp
//==================================================================================================
#include <windows.h>
#include <wingdi.h>
#include <iostream>
using namespace std;
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
switch (msg) {
case WM_CREATE: {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
RECT clientRect;
GetClientRect(hwnd, &clientRect);
int windowWidth = clientRect.right - clientRect.left;
string str = "123";
SetTextAlign(hdc, VTA_CENTER);
TextOutA(hdc, windowWidth / 2, 50, str.c_str(), str.length());
EndPaint(hwnd, &ps);
break;
}
case WM_DESTROY: {
PostQuitMessage(0);
break;
}
default: {
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
return 0;
}
int main() {
WNDCLASS wc;
wc.lpfnWndProc = WndProc;
wc.hInstance = GetModuleHandle(NULL);
wc.lpszClassName = "WindowProgramClass";
RegisterClass(&wc);
HWND hwnd = CreateWindowEx(
0,
"WindowProgramClass",
"Window Program",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
NULL,
NULL,
GetModuleHandle(NULL),
NULL);
ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
//==================================================================================================