c++ - 如何使用 shellscalingapi.h 解决 C++ Windows 应用程序中的此链接器错误

标签 c++ linker-errors

我正在尝试编写 C++ 应用程序并收到链接器错误,我想我需要进入项目设置 (Visual Studio) 并添加一个 lib 文件,但我不知道该文件的名称和位置,我怎样才能知道?

#include "framework.h"
#include "aviDrawDX.h"
#include "aviDrawDX.h"
#include "shellscalingapi.h"
#include "windows.h"
#include <winuser.h>

#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst;                                // current instance
WCHAR szTitle[MAX_LOADSTRING];                  // The title bar text
WCHAR szWindowClass[MAX_LOADSTRING];            // the main window class name

// Forward declarations of functions included in this code module:
ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE);

1>aviDrawDX.obj : error LNK2019: unresolved external symbol SetProcessDpiAwareness referenced in function wWinMain
1>C:\Users\frank\Daten\Projekte\CPP\aviDrawDX\x64\Debug\aviDrawDX.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "aviDrawDX.vcxproj" -- FAILED.

最佳答案

问题已解决,我需要在链接器选项中添加 shcore.lib。

关于c++ - 如何使用 shellscalingapi.h 解决 C++ Windows 应用程序中的此链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55204731/

相关文章:

c++ - 有流行的C++服务框架吗?

c++ - 带有默认参数的成员函数指针

c++ - 使用选择排序对字符串进行排序

c++ - C++ 中的表示错误

c++ - 数组被错误地传递给 C++ 中的函数

c++ - SDL2 和 SDL_opengl_glext.h 未定义的外部

c - 对函数调用的 undefined reference

C++ 链接器错误 iostream 重载

c++ - 当我将带有非模板类的模板类放在同一个 cpp 文件中时出现链接错误 - C++

macos - 在没有 libSystem macOS 的情况下链接目标文件