msvc: Fix Win32 build error

This commit is contained in:
Calcitem 2021-01-23 23:38:02 +08:00
parent 8ae49592c7
commit c2b913fff1
10 changed files with 32 additions and 49 deletions

View File

@ -53,6 +53,8 @@
#define MTDF_AI
//#define PERFECT_AI
//#define PERFECT_AI_TEST
#ifdef TEST_MODE
#define DONOT_PLAY_SOUND
#endif // TEST_MODE

View File

@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.29009.5
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "millgame", "millgame.vcxproj", "{D6EBE2B6-17F9-30EA-AE68-9CD0BB526200}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perfect", "src\perfect\perfect.vcxproj", "{EDB1E279-1476-443B-84FA-150A5D3B5A10}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -23,20 +21,12 @@ Global
{D6EBE2B6-17F9-30EA-AE68-9CD0BB526200}.Release|x64.Build.0 = Release|x64
{D6EBE2B6-17F9-30EA-AE68-9CD0BB526200}.Release|x86.ActiveCfg = Release|Win32
{D6EBE2B6-17F9-30EA-AE68-9CD0BB526200}.Release|x86.Build.0 = Release|Win32
{EDB1E279-1476-443B-84FA-150A5D3B5A10}.Debug|x64.ActiveCfg = Debug|x64
{EDB1E279-1476-443B-84FA-150A5D3B5A10}.Debug|x64.Build.0 = Debug|x64
{EDB1E279-1476-443B-84FA-150A5D3B5A10}.Debug|x86.ActiveCfg = Debug|Win32
{EDB1E279-1476-443B-84FA-150A5D3B5A10}.Debug|x86.Build.0 = Debug|Win32
{EDB1E279-1476-443B-84FA-150A5D3B5A10}.Release|x64.ActiveCfg = Release|x64
{EDB1E279-1476-443B-84FA-150A5D3B5A10}.Release|x64.Build.0 = Release|x64
{EDB1E279-1476-443B-84FA-150A5D3B5A10}.Release|x86.ActiveCfg = Release|Win32
{EDB1E279-1476-443B-84FA-150A5D3B5A10}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Qt5Version = Qt5.13.0
SolutionGuid = {401C61DF-0B94-45A9-96C1-9BD069796A84}
Qt5Version = Qt5.13.0
EndGlobalSection
EndGlobal

View File

@ -44,7 +44,7 @@
<ConfigurationType>Application</ConfigurationType>
<IntermediateDirectory>release\</IntermediateDirectory>
<PrimaryOutput>MillGame</PrimaryOutput>
<EnableASAN>true</EnableASAN>
<EnableASAN>false</EnableASAN>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<PlatformToolset>v142</PlatformToolset>
@ -109,7 +109,7 @@
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(ProjectDir)\src;$(ProjectDir)\include;$(ProjectDir)\src\ui\qt;$(ProjectDir)\src\test;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)src;$(ProjectDir)include;$(ProjectDir)src\ui\qt;$(ProjectDir)src\test;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(ProjectDir)\src\ui\qt;$(ProjectDir)\src\;$(ProjectDir)\include;$(ProjectDir)\src\test;$(IncludePath)</IncludePath>
@ -124,7 +124,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(QTDIR)\include;release;\include;$(QTDIR)\mkspecs\win32-msvc;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtMultimediaWidgets;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtNetworkAuth;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 /D_HAS_STD_BYTE=0 %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>release\</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>None</DebugInformationFormat>
@ -145,7 +145,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>qtmain.lib;shell32.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Multimedia.lib;Qt5MultimediaWidgets.lib;Qt5Network.lib;Qt5Widgets.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>qtmain.lib;shell32.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Multimedia.lib;Qt5MultimediaWidgets.lib;Qt5Network.lib;Qt5Widgets.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(QTDIR)\lib;C:\openssl\lib;C:\Utils\my_sql\my_sql\lib;C:\Utils\postgresql\pgsql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /LTCG %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
@ -194,7 +194,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\src\ui\qt;$(ProjectDir)\src\ui;$(ProjectDir)\src\test;$(ProjectDir)\src;$(ProjectDir)\include;.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(QTDIR)\include;release;\include;$(QTDIR)\mkspecs\win32-msvc;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtMultimediaWidgets;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtNetworkAuth;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 /D_HAS_STD_BYTE=0 %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>release\</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>None</DebugInformationFormat>
@ -215,7 +215,7 @@
<OmitFramePointers>true</OmitFramePointers>
</ClCompile>
<Link>
<AdditionalDependencies>qtmain.lib;shell32.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Multimedia.lib;Qt5MultimediaWidgets.lib;Qt5Network.lib;Qt5Widgets.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>qtmain.lib;shell32.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Multimedia.lib;Qt5MultimediaWidgets.lib;Qt5Network.lib;Qt5Widgets.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(QTDIR)\lib;C:\openssl\lib;C:\Utils\my_sql\my_sql\lib;C:\Utils\postgresql\pgsql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
@ -351,7 +351,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>qtmaind.lib;shell32.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Multimediad.lib;Qt5MultimediaWidgetsd.lib;Qt5Networkd.lib;Qt5Widgetsd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>qtmaind.lib;shell32.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Multimediad.lib;Qt5MultimediaWidgetsd.lib;Qt5Networkd.lib;Qt5Widgetsd.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(QTDIR)\lib;C:\openssl\lib;C:\Utils\my_sql\my_sql\lib;C:\Utils\postgresql\pgsql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
@ -757,6 +757,7 @@
<ClCompile Include="src\perfect\minMaxAI.cpp" />
<ClCompile Include="src\perfect\perfect.cpp" />
<ClCompile Include="src\perfect\perfectAI.cpp" />
<ClCompile Include="src\perfect\perfect_test.cpp" />
<ClCompile Include="src\perfect\randomAI.cpp" />
<ClCompile Include="src\perfect\strLib.cpp" />
<ClCompile Include="src\perfect\threadManager.cpp" />

View File

@ -452,6 +452,9 @@
<ClCompile Include="src\perfect\perfect.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\perfect_test.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="millgame.rc">

View File

@ -1,14 +0,0 @@
/*********************************************************************\
config.h
Copyright (c) Thomas Weber. All rights reserved.
Copyright (C) 2021 The Sanmill developers (see AUTHORS file)
Licensed under the GPLv3 License.
https://github.com/madweasel/madweasels-cpp
\*********************************************************************/
#ifndef CONFIG_H
#define CONFIG_H
#define SELF_PLAY
#endif // CONFIG_H

View File

@ -1,6 +1,7 @@
#include "perfect.h"
#include "position.h"
#include "misc.h"
#include "config.h"
// Perfect AI
Mill *mill = nullptr;
@ -8,12 +9,6 @@ PerfectAI *ai = nullptr;
int perfect_init(void)
{
#ifdef _DEBUG
char databaseDirectory[] = "D:\\database";
#elif _RELEASE_X64
char databaseDirectory[] = "";
#endif
if (mill != nullptr || ai != nullptr) {
return 0;
}
@ -197,6 +192,7 @@ bool perfect_command(const char *cmd)
return false;
#if 0
args = sscanf(cmd, "Player%1u give up!", &t);
// if (args == 1) {
@ -219,6 +215,7 @@ bool perfect_command(const char *cmd)
#endif /* THREEFOLD_REPETITION */
return false;
#endif
}
// mill->getWinner() == 0

View File

@ -1,11 +1,12 @@
#ifndef PERFECT_H
#define PERFECT_H
#include "mill.h"
#include "perfectAI.h"
#include "types.h"
static const char databaseDirectory[] = "D:\\database";
extern Mill *mill;
extern PerfectAI *ai;

View File

@ -82,7 +82,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)..\..\include;$(ProjectDir)..;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

View File

@ -5,32 +5,34 @@
#include "miniMaxAI.h"
#include "randomAI.h"
#include "perfectAI.h"
#include "perfect.h"
#include "config.h"
using namespace std;
extern Mill *mill;
extern PerfectAI *ai;
unsigned int startTestFromLayer = 0;
unsigned int endTestAtLayer = NUM_LAYERS - 1;
#ifdef _DEBUG
char databaseDirectory[] = "D:\\database";
#elif _RELEASE_X64
char databaseDirectory[] = "";
#endif
bool calculateDatabase = false;
#ifdef PERFECT_AI_TEST
int main(void)
#else
int perfect_main(void)
#endif
{
// locals
bool playerOneHuman = false;
bool playerTwoHuman = false;
char ch[100];
unsigned int from, to;
Mill *mill = new Mill();
PerfectAI *ai = new PerfectAI(databaseDirectory);
mill = new Mill();
ai = new PerfectAI(databaseDirectory);
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
srand(GetTickCount());
@ -173,7 +175,6 @@ int main(void)
cout << "\n A program error has occurred!\n\n";
}
out:
char end;
cin >> end;

View File

@ -40,6 +40,7 @@ QString getAppFileName()
return filename;
}
#ifndef PERFECT_AI_TEST
int main(int argc, char *argv[])
{
Bitboards::init();
@ -60,6 +61,7 @@ int main(int argc, char *argv[])
return QApplication::exec();
}
#endif // !PERFECT_AI_TEST
#endif // !UCT_DEMO
#endif // QT_GUI_LIB