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

时间:2019-03-17 07:19:11

标签: 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.

1 个答案:

答案 0 :(得分:0)

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