I am making c++ dll in visual studio community 2019 but as I created project its shows me errors. default code for c++ dll
// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
But visual studio gives these errors:
E1696 cannot open source file "windows.h"
E0020 identifier "BOOL" is undefined
E0065 expected a ';' 4
I have try messing with some settings which I seen on internet but that haven't helped.
>>E1696 cannot open source file "windows.h"
First of all you should check the physical existence of the file, it should be in "C:\Program Files (x86)\Windows Kits\10\Include" folder in your Visual Studio install directory.
If the file exists, you should Go to Tools->Options and expand Projects and solutions. Select VC++ Directories from the tree and choose Include Files from the combo on the right.You should see:
$(WindowsSDK_IncludePath);
If the file does not exist,you should download and install the Windows 10 SDK in the VS2019 installer.
The selected version needs to be the same as the version set in the project.
>>E0020 identifier "BOOL" is undefined E0065 expected a ';' 4
When you solve the first error, these error will also be solved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.