otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.55k stars 1.04k forks source link

[Compilation]: missing otpch.h in compilation error #4731

Closed ArturKnopik closed 1 month ago

ArturKnopik commented 1 month ago

By submitting this compilation problem issue, you agree to the following.

Server Version

1.7 (Master)

Operation System

Windows

OS Description

No response

Compiler

MSVC

Buildtype

Debug

Compiler Description

Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.9.0

Possible Pull Requests which are to blame

Error Message

Severity    Code    Description Project File    Line    Suppression State   Details
Error   C2079   'std::pair<const Position,SpectatorVec>::second' uses undefined class 'SpectatorVec'    theforgottenserver  D:\programy\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\utility    466     
Error (active)  E0020   identifier "__builtin_FUNCSIG" is undefined theforgottenserver  D:\dev\vcpkg\installed\x64-windows\include\boost\asio\detail\throw_error.hpp    39      
Error (active)  E0020   identifier "__builtin_FUNCSIG" is undefined theforgottenserver  D:\dev\vcpkg\installed\x64-windows\include\boost\asio\detail\throw_error.hpp    48      
Error   C1010   unexpected end of file while looking for precompiled header. Did you forget to add '#include "otpch.h"' to your source? theforgottenserver  D:\dev\forgottenserver_AK\src\http\cacheinfo.cpp    22      
Error   C1010   unexpected end of file while looking for precompiled header. Did you forget to add '#include "otpch.h"' to your source? theforgottenserver  D:\dev\forgottenserver_AK\src\http\error.cpp    15      
Error   C1010   unexpected end of file while looking for precompiled header. Did you forget to add '#include "otpch.h"' to your source? theforgottenserver  D:\dev\forgottenserver_AK\src\http\http.cpp 52      
Error   C1010   unexpected end of file while looking for precompiled header. Did you forget to add '#include "otpch.h"' to your source? theforgottenserver  D:\dev\forgottenserver_AK\src\http\listener.cpp 62      
Error   C1010   unexpected end of file while looking for precompiled header. Did you forget to add '#include "otpch.h"' to your source? theforgottenserver  D:\dev\forgottenserver_AK\src\http\login.cpp    169     
Error   C1010   unexpected end of file while looking for precompiled header. Did you forget to add '#include "otpch.h"' to your source? theforgottenserver  D:\dev\forgottenserver_AK\src\http\router.cpp   59      
Error   C1010   unexpected end of file while looking for precompiled header. Did you forget to add '#include "otpch.h"' to your source? theforgottenserver  D:\dev\forgottenserver_AK\src\http\session.cpp  102     
Severity    Code    Description Project File    Line    Suppression State   Details
Error   C2079   'std::pair<const Position,SpectatorVec>::second' uses undefined class 'SpectatorVec'    theforgottenserver  D:\programy\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\utility    466
reyaleman commented 1 month ago

add #include "spectators.h" to map.h file, cheers

ArturKnopik commented 1 month ago

add #include "spectators.h" to map.h file, cheers

is there

EvilHero90 commented 1 month ago

I can reproduce this on Debug build, Release is not effected by this

EvilHero90 commented 1 month ago

I have a workaround solution since VS doesn't like subdirectories

1) map.h

This will let you compile the Debug Build just fine

xmish commented 1 month ago
diff --git a/src/http/cacheinfo.cpp b/src/http/cacheinfo.cpp
index 3e7b8f32..0a4d918a 100644
--- a/src/http/cacheinfo.cpp
+++ b/src/http/cacheinfo.cpp
@@ -1,8 +1,8 @@
-#include "../otpch.h"
+#include "otpch.h"

 #include "cacheinfo.h"

-#include "../database.h"
+#include "database.h"
 #include "error.h"

 namespace beast = boost::beast;
diff --git a/src/http/error.cpp b/src/http/error.cpp
index bb5ff177..16229eb7 100644
--- a/src/http/error.cpp
+++ b/src/http/error.cpp
@@ -1,3 +1,4 @@
+#include "otpch.h"
 #include "error.h"

 namespace beast = boost::beast;
diff --git a/src/http/http.cpp b/src/http/http.cpp
index cd4fb999..348da0a8 100644
--- a/src/http/http.cpp
+++ b/src/http/http.cpp
@@ -1,5 +1,5 @@
 #define BOOST_ASIO_NO_DEPRECATED
-
+#include "otpch.h"
 #include "http.h"

 #include "listener.h"
diff --git a/src/http/listener.cpp b/src/http/listener.cpp
index 9228beb8..67ad4b38 100644
--- a/src/http/listener.cpp
+++ b/src/http/listener.cpp
@@ -1,3 +1,4 @@
+#include "otpch.h"
 #include "listener.h"

 #include "session.h"
diff --git a/src/http/login.cpp b/src/http/login.cpp
index bd224589..feb77482 100644
--- a/src/http/login.cpp
+++ b/src/http/login.cpp
@@ -1,9 +1,9 @@
-#include "../otpch.h"
+#include "otpch.h"

 #include "login.h"

-#include "../base64.h"
-#include "../game.h"
+#include "base64.h"
+#include "game.h"
 #include "error.h"

 #include <fmt/format.h>
diff --git a/src/http/router.cpp b/src/http/router.cpp
index 3614419d..abbb0763 100644
--- a/src/http/router.cpp
+++ b/src/http/router.cpp
@@ -1,3 +1,4 @@
+#include "otpch.h"
 #include "router.h"

 #include "cacheinfo.h"
diff --git a/src/http/session.cpp b/src/http/session.cpp
index dcaa1fdf..ee7f32f9 100644
--- a/src/http/session.cpp
+++ b/src/http/session.cpp
@@ -1,3 +1,4 @@
+#include "otpch.h"
 #include "session.h"

 #include "router.h"
diff --git a/vc17/theforgottenserver.vcxproj b/vc17/theforgottenserver.vcxproj
index 888e01ac..b8b79a90 100644
--- a/vc17/theforgottenserver.vcxproj
+++ b/vc17/theforgottenserver.vcxproj
@@ -95,7 +95,7 @@
       <Optimization>Disabled</Optimization>
       <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
       <EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
-      <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <LanguageStandard>stdcpp20</LanguageStandard>
     </ClCompile>
     <Link>
@@ -110,7 +110,7 @@
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
       <EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
-      <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <LanguageStandard>stdcpp20</LanguageStandard>
     </ClCompile>
     <Link>
@@ -128,7 +128,7 @@
       <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
       <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
       <EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
-      <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <LanguageStandard>stdcpp20</LanguageStandard>
     </ClCompile>
     <Link>
@@ -150,7 +150,7 @@
       <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
       <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
       <EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
-      <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(VcpkgRoot)include\luajit;..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <LanguageStandard>stdcpp20</LanguageStandard>
     </ClCompile>
     <Link>

@EvilHero90 works fine ;)

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 21:14 and took 20,947 seconds ==========
EvilHero90 commented 1 month ago

I'll cover your patch in the Wiki page, thank you for providing it