我正在尝试编写 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/