etorth / mir2x

open source MMORPG game

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: ‘FILE’ in namespace ‘std’ does not name a type

n7st opened this issue · comments

Hi,

I'm hitting an error during make.

In file included from /home/mike/src/Applications/mir2x/client/src/pngtexdb.hpp:24,
                 from /home/mike/src/Applications/mir2x/client/src/inventoryboard.cpp:19:
/home/mike/src/Applications/mir2x/common/src/zsdb.hpp:76:14: error: ‘FILE’ in namespace ‘std’ does not name a type
   76 |         std::FILE *m_fp;
      |              ^~~~
compilation terminated due to -Wfatal-errors.
make[2]: *** [client/src/CMakeFiles/client.dir/build.make:303: client/src/CMakeFiles/client.dir/inventoryboard.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1108: client/src/CMakeFiles/client.dir/all] Error 2
make: *** [Makefile:171: all] Error 2

Arch Linux, amd64.

The following seems to correct the build error (for my platform), and the server and client will run:

diff --git a/common/src/zsdb.hpp b/common/src/zsdb.hpp
index 99125705..efad71ed 100644
--- a/common/src/zsdb.hpp
+++ b/common/src/zsdb.hpp
@@ -73,7 +73,7 @@ class ZSDB final
 #pragma pack(pop)
 
     private:
-        std::FILE *m_fp;
+        FILE *m_fp;
 
     private:
         ZSTD_DCtx  *m_DCtx;

try pull and rebuild, I added the cstdio header.

This fixed this issue, thanks!