Jump to content

cmake build error common/stl.h


Recommended Posts

https://metin2.download/picture/GIJ1rKas4zgBxa131bZmQ1hn22NKVe5p/.png

[  7%] Built target libthecore
[ 14%] Built target shared
[ 26%] Built target lua
Scanning dependencies of target game
[ 26%] Building CXX object src/game/CMakeFiles/game.dir/BattleArena.cpp.o
In file included from /usr/m2/test22/src/game/BattleArena.cpp:6:
In file included from /usr/m2/test22/src/game/char_manager.h:4:
/usr/m2/test22/src/common/stl.h:98:32: error: expected ')'
        template <typename T> T MIN(T a, T b)
                                      ^
/usr/m2/test22/src/common/stl.h:98:26: note: to match this '('
        template <typename T> T MIN(T a, T b)
                                ^
/usr/include/sys/param.h:305:20: note: expanded from macro 'MIN'
#define MIN(a,b) (((a)<(b))?(a):(b))
                   ^
In file included from /usr/m2/test22/src/game/BattleArena.cpp:6:
In file included from /usr/m2/test22/src/game/char_manager.h:4:
/usr/m2/test22/src/common/stl.h:98:26: error: expected ')'
        template <typename T> T MIN(T a, T b)
                                ^
/usr/include/sys/param.h:305:23: note: expanded from macro 'MIN'
#define MIN(a,b) (((a)<(b))?(a):(b))
                      ^
/usr/m2/test22/src/common/stl.h:98:26: note: to match this '('
/usr/include/sys/param.h:305:19: note: expanded from macro 'MIN'
#define MIN(a,b) (((a)<(b))?(a):(b))
                  ^
In file included from /usr/m2/test22/src/game/BattleArena.cpp:6:
In file included from /usr/m2/test22/src/game/char_manager.h:4:
/usr/m2/test22/src/common/stl.h:98:26: error: expected ')'
        template <typename T> T MIN(T a, T b)
                                ^
/usr/include/sys/param.h:305:28: note: expanded from macro 'MIN'
#define MIN(a,b) (((a)<(b))?(a):(b))
                           ^
/usr/m2/test22/src/common/stl.h:98:26: note: to match this '('
/usr/include/sys/param.h:305:18: note: expanded from macro 'MIN'
#define MIN(a,b) (((a)<(b))?(a):(b))
                 ^
In file included from /usr/m2/test22/src/game/BattleArena.cpp:6:
In file included from /usr/m2/test22/src/game/char_manager.h:4:
/usr/m2/test22/src/common/stl.h:98:30: warning: variable templates are a C++14 extension [-Wc++14-extensions]
        template <typename T> T MIN(T a, T b)
                                    ^
/usr/m2/test22/src/common/stl.h:100:3: error: expected expression
                return a < b ? a : b;
                ^
/usr/m2/test22/src/common/stl.h:101:3: error: expected ';' at end of declaration
        }
         ^
         ;
/usr/m2/test22/src/common/stl.h:103:32: error: expected ')'
        template <typename T> T MAX(T a, T b)
                                      ^
/usr/m2/test22/src/common/stl.h:103:26: note: to match this '('
        template <typename T> T MAX(T a, T b)
                                ^
/usr/include/sys/param.h:306:20: note: expanded from macro 'MAX'
#define MAX(a,b) (((a)>(b))?(a):(b))
                   ^
In file included from /usr/m2/test22/src/game/BattleArena.cpp:6:
In file included from /usr/m2/test22/src/game/char_manager.h:4:
/usr/m2/test22/src/common/stl.h:103:26: error: expected ')'
        template <typename T> T MAX(T a, T b)
                                ^
/usr/include/sys/param.h:306:23: note: expanded from macro 'MAX'
#define MAX(a,b) (((a)>(b))?(a):(b))
                      ^
/usr/m2/test22/src/common/stl.h:103:26: note: to match this '('
/usr/include/sys/param.h:306:19: note: expanded from macro 'MAX'
#define MAX(a,b) (((a)>(b))?(a):(b))
                  ^
In file included from /usr/m2/test22/src/game/BattleArena.cpp:6:
In file included from /usr/m2/test22/src/game/char_manager.h:4:
/usr/m2/test22/src/common/stl.h:103:26: error: expected ')'
        template <typename T> T MAX(T a, T b)
                                ^
/usr/include/sys/param.h:306:28: note: expanded from macro 'MAX'
#define MAX(a,b) (((a)>(b))?(a):(b))
                           ^
/usr/m2/test22/src/common/stl.h:103:26: note: to match this '('
/usr/include/sys/param.h:306:18: note: expanded from macro 'MAX'
#define MAX(a,b) (((a)>(b))?(a):(b))
                 ^
In file included from /usr/m2/test22/src/game/BattleArena.cpp:6:
In file included from /usr/m2/test22/src/game/char_manager.h:4:
/usr/m2/test22/src/common/stl.h:103:30: warning: variable templates are a C++14 extension [-Wc++14-extensions]
        template <typename T> T MAX(T a, T b)
                                    ^
/usr/m2/test22/src/common/stl.h:103:30: error: redefinition of 'T'
/usr/m2/test22/src/common/stl.h:98:30: note: previous definition is here
        template <typename T> T MIN(T a, T b)
                                    ^
/usr/m2/test22/src/common/stl.h:105:3: error: expected expression
                return a > b ? a : b;
                ^
/usr/m2/test22/src/common/stl.h:106:3: error: expected ';' at end of declaration
        }
         ^
         ;
/usr/m2/test22/src/game/BattleArena.cpp:105:31: warning: illegal character en

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

You need a third argument for these. You can make a research of what exactly this argument is or use mine here.

template <typename T> T MIN(T a, T b)
	{
		return a < b ? a : b;
	}

	template <typename T> T MAX(T a, T b)
	{
		return a > b ? a : b;
	}

	template <typename T> T MINMAX(T min, T value, T max)
	{
		T tv;

		tv = (min > value ? min : value);
		return (max < tv) ? max : tv;
	}

I hope it helps.

Link to comment
Share on other sites

  • Active+ Member
template <typename T> T _MIN(T a, T b)
	{
		return a < b ? a : b;
	}

	template <typename T> T _MAX(T a, T b)
	{
		return a > b ? a : b;
	}

	template <typename T> T MINMAX(T min, T value, T max)
	{
		T tv;

		tv = (min > value ? min : value);
		return (max < tv) ? max : tv;
	}

Fix

  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.