Jump to content
Maintenance : Final step ×

Compiling Error w/ TMP4 Source


Go to solution Solved by TheEqualizer,

Recommended Posts

 

Hello,

Source : [40250] Reference Serverfile + Client + Src [15 Available Languages] by TMP4

I've deployed FreeBSD-13.3-RELEASE-i386 on VPS. I've downloded the server and run it. Me and my friends can join the server and play, there is no problem with that. But I can't build the game source. Server is 32-Bit, I've installed the provided pkgs.

 

Here is the some errors:

 

Spoiler
root@metin2:/usr/metin2/src/server/game/src # gmake -j9
compile OXEvent.cpp
compile BattleArena.cpp
compile ani.cpp
compile arena.cpp
compile battle.cpp
compile building.cpp
compile castle.cpp
compile char.cpp
compile char_affect.cpp
In file included from ani.cpp:In file included from 11castle.cpp:
:In file included from In file included from 15./char.hBattleArena.cpp:
::In file included from 65./char_manager.h:
:
:In file included from 8./../../common/stl.h./char_manager.h:
::498./../../common/stl.h::
:1549:./../../common/stl.h: :1549:: error: 15: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?In file included from
char.cpperror: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?   :496
 | :
no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?   :In file included from 49 In file included from ./char.h
 | p:   :uchar_affect.cpp649 b::
 | pl5:ui:
./../../common/stl.h bcIn file included from :pl ./char.h49uis::bct15l d6:is::
 ct: du./../../common/stl.hs:nerror: t:a:durIn file included from 49:nyno template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?:a_battle.cpp:urf:15
nyu   a_n5:49rfc | yut:
 :_niIn file included from  fcoputnuni<bco_ltnTii<pco_* nT,s<p t_*sdT,t:p d:*s:u,t:n dsas:irt:zydse_:i_f:ztuse>ni_czt
te>      i_| ot
n>               ~~~~~^~~~~~~~~~~~~~<|
_
T               ~~~~~^~~~~~~~~~~~~~      p|
| *,         ~~~~~^~~~~~~~~~~~~~                    __unary_function
|
st                    __unary_functiond|
/usr/include/c++/v1/__functional/unary_function.h:./char.h:::              __unary_function46serror:
/usr/include/c++/v1/__functional/unary_function.h:i6:1z:
46:eno template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?/usr/include/c++/v1/__functional/unary_function.h: _:1t./../../common/stl.h46:>: note: :
1
49   :'__unary_function' declared here       note: | :49
'__unary_function' declared here            ~~~~~^~~~~~~~~~~~~~15 | note: 46

 | ::'__unary_function' declared here   u      46s|
 | ip   un              __unary_functionu46sg
b | i lun_isg_/usr/include/c++/v1/__functional/unary_function.hci u: n_n46sg_a:t ur1d_ny::_a_ :urfunyuna_nnote: arfcryut'__unary_function' declared herey_ni_fco
futn   uni 46nco= | ctn uti _sio=_ion unn _ng<=_a _ ur_T_ny_p_a_u*urfn,nyua a_nrsrfcytyut_d_nif:fcou:utnnsni_cicoktztneiei_eo_oerror: kpntne_ >_el=kpa
e_y_      eno template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?lo_| pauu_ytn         ~~~~~^~~~~~~~~~~~~~lo_a
aubrytay      o_s_| ubefta<u              __unary_function_s_n
beAca<rts_gi/usr/include/c++/v1/__functional/unary_function.heA,o:<r n46_g__:A,Rk1r ee:g_se ,Rup el__stlnote: Ru>ael;y'__unary_function' declared herestou>
u
;      t
l| _46   t
b | 49>      ^au;|
ss | ei
^<n
:In file included from _g|  ani.cppA :r_^p11g_
In file included from u:
,ucastle.cppIn file included from  nb:./char.h_alIn file included from 15:RriBattleArena.cpp:
6ey:In file included from :
s_5./char_manager.huf:
:./../../common/stl.hluIn file included from 8:tn./char_manager.h:
118>c::;t8./../../common/stl.h33i:
::
o118       n./../../common/stl.h:|  :33=118:error: ^ :
_33_:no template named 'unary_function'; did you mean '__unary_function'?u error: cn
 a  In file included from rerror: no template named 'unary_function'; did you mean '__unary_function'?118In file included from schar.cppy | :_
        6fno template named 'unary_function'; did you mean '__unary_function'?          :
u118cIn file included from n
 | l./char.hc          a:t118        s6arena.cppti | cs:
o        l n        av./../../common/stl.h_cso:klsi118ea d:esv_33psom:_ ie lvdmao__yimferror: odeuu_mntm__no template named 'unary_function'; did you mean '__unary_function'?_eftbmu
a_n:  sf_ 118eutp | <n u        __:b        At lcr pilg:uca, b s plus_uin Rbcavel rosiuyiucn_dl af_turum>nyne;a_cmrft_
yuif      _nou| fcnnut<_^ni_t
coT tn:dy:i<  9:o_*p:
:nT,uIn file included from uIn file included from <y bchar_affect.cpp_ vl./char.hn:T*oi5y,ic:
  d In file included from *v>u./char.h,on: i
a6vd      r:
o>| yi_./../../common/stl.hd
                                              ^~~~~~~~~~~~~~f:>
u118| n:
      c33                                                    ^~~~~~~~~~~~~~| t:|
i                                               __unary_functiono                                              ^~~~~~~~~~~~~~
n
| <error: _                                                    __unary_function/usr/include/c++/v1/__functional/unary_function.hT|
:yno template named 'unary_function'; did you mean '__unary_function'?46                                               __unary_function:*

/usr/include/c++/v1/__functional/unary_function.h1,  :: 11846 v | /usr/include/c++/v1/__functional/unary_function.h:o        :1i        46:note: dc: >l1'__unary_function' declared herea:
s note:
      s   |  '__unary_function' declared here46vnote:  |                                               ^~~~~~~~~~~~~~o
u
i'__unary_function' declared here   s:ad46i      6r_
 | n| m   uge46s                                               __unary_functionm | i_
_un_fsguui n/usr/include/c++/v1/__functional/unary_function.hnn_a:_g_r46t uy: _n_1:_af: uru pnynua_cbrftnote: lyuii_no'__unary_function' declared herecfcn ut
uni=   nco 46atn_ | ri _uyo=us_n nif _anu=_rgn uy c_n__t_af_iuruuonynnna_ca<rftr_yuiyT_no_yfcnf ut_u*nikn,coec tnetvi_piook_oinelnd_ea >kpy=e_o
elu_      pat_| _y_ulobn                                              ^~~~~~~~~~~~~~auaa
ytsro_ey      ub<_ta_f:
y| _sAubern                                              __unary_functiona<gc
s_,teA i<r_o/usr/include/c++/v1/__functional/unary_function.h_gRn:A,e_46r sk:g_ue1,Rle: etp _s>_Ru;lelanote: st
yu>      o'__unary_function' declared herel;| utt
>
^_   ;
b46| a |
su      ^_In file included from es|
In file included from ./../../common/stl.hfani.cpp<iOXEvent.cpp:_n^11Ag
:u::
r 49n9In file included from g_In file included from ./char.h,_:c:
castle.cpp: u:6_n15:
Ra15tIn file included from :
er:i./char.hIn file included from In file included from ./../../common/stl.hsyBattleArena.cpp./char_manager.h:u_::139lf58:tu:
:
37>nIn file included from :;c./char_manager.h./../../common/stl.h t::
i8139      o:
:error: | n37 ./../../common/stl.h:^=: no template named 'unary_function'; did you mean '__unary_function'?
 139_:
_37error:   u:139 o:n  | n6In file included from ano template named 'unary_function'; did you mean '__unary_function'?        char.cppr        :yerror:
c6:
In file included from ./char.h:6:
./../../common/stl.h:139:37: error: no template named 'unary_function'; did you mean '__unary_function'?
  139 |                 class void_mem_fun_ref_t : public unary_function<_Ty, void>
      |                                                   ^~~~~~~~~~~~~~
      |                                                   __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
   46 | using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
      | ^
_  l<:
f139aerror: _uno template named 'unary_function'; did you mean '__unary_function'? | sT./../../common/stl.hn        sp:c
         no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?*49t  cvi139lo,:o | ai
15n        sds   :_        s_t49 kc mdelve: | eaom::pss void_mem_fun_ref_t : public unary_function<_Ty, void>
      |                                                   ^~~~~~~~~~~~~~
      |                                                   __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
   46 | using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
      | ^
id_mem_fun_ref_t : public unary_function<_Ty, void>
      |                                                   ^~~~~~~~~~~~~~
      |                                                   __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
   46 | using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
      | ^
_s error: _fipluzauneybno template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?__olrtui
e>tc   f_ 49_
bs | t      at: | sd :e:p          ~~~~~^~~~~~~~~~~~~~<:up
_ubuAnlb      rail| grci,c              __unary_function y
__suRftneuda/usr/include/c++/v1/__functional/unary_function.hsr:un:y46lc:_:tf1>tuu:;inn oac
nrt      inote: | <yo__n'__unary_function' declared here^Tf<
pu_
*nT   ,cy46In file included from  t, | char_affect.cppsi u:vs5tooi:
dninIn file included from :<dg./char.h:_> :_6sT
_:
ip      uz*| n./../../common/stl.he,a:                                                  ^~~~~~~~~~~~~~r139
_ y:      ts| _37                                                  __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
   46 | using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
      | ^
In file included from >tf:u dbuilding.cpp
n::      c:8| terror: si:
i         ~~~~~^~~~~~~~~~~~~~oIn file included from z
nno template named 'unary_function'; did you mean '__unary_function'? ./char.he      =
_:|    t6_139>:
              __unary_function_ |
u
n        ./../../common/stl.h      ac:| /usr/include/c++/v1/__functional/unary_function.hrl49:ya         ~~~~~^~~~~~~~~~~~~~:46_s
:fs151u ::nv       co | tiid              __unary_functionnote: o_
nmerror: '__unary_function' declared here_ekm/usr/include/c++/v1/__functional/unary_function.h
e_no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?:   ef4646pu:
 | _n1   ul_:49sar iye | nof:gu_note:   ttp__ '__unary_function' declared here_b:uua
bnsp   laeu46ir<b | y_luc_Ais frcis3ug nt errorn,ugdsc n  generatedt_a_:.
iRr_:gmake: *** [Makefile:103: OBJDIR/ani.o] Error 1
oeyugmake: *** Waiting for unfinished jobs....
ns_n ufa=lur tny_>c__;tfuiun
ona      ncr| <ty_i_^Tof
ynu, n =cuv tno_iaIn file included from i_orbattle.cppdun:>n_y5ak:

reIn file included from       ye./char.h| _p:f_6                                                  ^~~~~~~~~~~~~~ul:

nacy./../../common/stl.h      to:| iu118ot:                                                  __unary_functionn_33
_b:ka es/usr/include/c++/v1/__functional/unary_function.hee:p<error: 46__:lA1arno template named 'unary_function'; did you mean '__unary_function'?:yg o,u _
t_  note: _Rf118be | '__unary_function' declared hereas        su
elc   <tu3l46_>na | A; errorcsurssg
 i,      vn | og_i R^d_e
__smuuenlstmat generatedi_r>fy;.
ou_nIn file included from nf
arena.cpp_u      gmake: *** [Makefile:103: OBJDIR/castle.o] Error 1
<:tn| 9 c_:
:t^In file included from  i
./char.hpo:un6b T:
l=i p./../../common/stl.hc_*: _In file included from 118uuOXEvent.cpp:nn:33aa9:rr:
 yyIn file included from __./char.hff:error: uu6nn:
ccno template named 'unary_function'; did you mean '__unary_function'?tt./../../common/stl.hii:
oo118  nn:118<_33 | _k:        Te         yec pl*_error: a,ls asvyno template named 'unary_function'; did you mean '__unary_function'? ooviu
odt  i>_118db | _
a        m      s        e| ecm<l_                                              ^~~~~~~~~~~~~~_af
Asursn      g _| ,vt o                                               __unary_function_i:
Rd e_psmu/usr/include/c++/v1/__functional/unary_function.hueb:lml46t_i:>fc1;u :nu
_n      ta|  rnote: :y^ _'__unary_function' declared here
pfuu
bn   ,lc46 it | sciut osdunin<n:a_g:rT syy_i_ _zf*uu,nen a_cvrtoytii_>odfn>u
<n      _
c| T      ty| i         ~~~~~^~~~~~~~~~~~~~ o
*                                              ^~~~~~~~~~~~~~n,
  =      v       o| _| i_d                                              __unary_functionu              __unary_function>
n
a
r      /usr/include/c++/v1/__functional/unary_function.hy/usr/include/c++/v1/__functional/unary_function.h| :_:46f                                              ^~~~~~~~~~~~~~:u46
1n::c1       t| i:o                                               __unary_functionnote: n
_'__unary_function' declared herekenote: /usr/include/c++/v1/__functional/unary_function.h
e:   p'__unary_function' declared here4646_: | l1ua
:sy    io46nu | gtnote:  _u_b'__unary_function' declared here_aus
ne   a<46r_ | yAu_rsfgiu,nn gc_ tR_ie_osunun la=tr >y_;__fu
un      na| crty^i_
ofnu n=cs ti_in_o3unIn file included from gbattle.cpp:5:
In file included from ./char.h:6:
./../../common/stl.h:139:37: error: no template named 'unary_function'; did you mean '__unary_function'?
  139 |                 class void_mem_fun_ref_t : public unary_function<_Ty, void>
      |                                                   ^~~~~~~~~~~~~~
      |                                                   __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared heren_
   46 | using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
      | ^
 ak errorre_yes__p generateduf_ul.
nnaacygmake: *** [Makefile:103: OBJDIR/BattleArena.o] Error 1
rtoiuyot_n_f_bukanesceetp<i__lAoarnyg o,=u  t___R_beuassunela<tr_>yA;_rfg
u,       | n_cR^e
tsiulotnIn file included from >_arena.cpp;:k9
e:
      In file included from | e./char.h:^p6
:
_./../../common/stl.hl:In file included from 139aOXEvent.cpp:y:379:o:
 In file included from u./char.ht:error: 6:
no template named 'unary_function'; did you mean '__unary_function'?./../../common/stl.h:
139  :13937 | :                 clerror: assno template named 'unary_function'; did you mean '__unary_function'? v
o  i139d | _        m        ecml_afsusn _vroeifd__tm e:m _pfuubnl_irce fu_nta r:y _pfuubnlcitci ounn<a_rTyy_,f uvnocitdi>on
<      _| Ty                                                  ^~~~~~~~~~~~~~,
 v      o| id                                                  __unary_function>

      /usr/include/c++/v1/__functional/unary_function.h| :46                                                  ^~~~~~~~~~~~~~:
1:       |                                                   __unary_functionnote:
'__unary_function' declared here/usr/include/c++/v1/__functional/unary_function.h
:   4646: | 1u:s ingnote:  _'__unary_function' declared here_u
n   a46r | yu_sfiunngc t_i_ounn a=r y___fuunnacrtyi_ofnu n=c t_i_ounn_akrey_e_pfb_ulnaacytsoiuoetn__<bkaeseep<__lAarygo,u t__Rbeassuel<t_>A;rg
,       | _R^e
sul_tA>r;g,
       | _R^e
sul3t> error;s generated
      .
| gmake: *** [Makefile:103: OBJDIR/char_affect.o] Error 1
^
In file included from building.cpp:8:
In file included from ./char.h:6:
./../../common/stl.h:118:33: error: no template named 'unary_function'; did you mean '__unary_function'?
  118 |                 class void_mem_fun_t : public unary_function<_Ty *, void>
      |                                               ^~~~~~~~~~~~~~
      |                                               __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
   46 | using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
      | ^
In file included from building.cpp:8:
3In file included from ./char.h:6:
./../../common/stl.h:139:37: error: no template named 'unary_function'; did you mean '__unary_function'?
  139 |                 class void_mem_fun_ref_t : public error usnary_function<_ generatedTy, void>
      |                                                   ^~~~~~~~~~~~~~
      |                                                   __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
   46 | using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
      | ^
.
gmake: *** [Makefile:103: OBJDIR/arena.o] Error 1
3 errors generated.
gmake: *** [Makefile:103: OBJDIR/OXEvent.o] Error 1
3 errors generated.
gmake: *** [Makefile:103: OBJDIR/battle.o] Error 1
3 errors generated.
gmake: *** [Makefile:103: OBJDIR/building.o] Error 1
3 errors generated.
gmake: *** [Makefile:103: OBJDIR/char.o] Error 1

I didnt know if i should change it or not bu, i've decided to change all 'unary_function' to '__unary_function'

 

Then i got this error while compiling :

Spoiler
root@metin2:/usr/metin2/src/server/game/src # gmake -j9
compile FSM.cpp
compile MarkConvert.cpp
compile MarkImage.cpp
compile BattleArena.cpp
compile MarkManager.cpp
compile TrafficProfiler.cpp
compile OXEvent.cpp
compile ani.cpp
compile arena.cpp
compile banword.cpp
compile battle.cpp
compile blend_item.cpp
compile block_country.cpp
compile buffer_manager.cpp
compile building.cpp
compile castle.cpp
compile char.cpp
compile char_affect.cpp
compile char_battle.cpp
compile char_change_empire.cpp
compile char_horse.cpp
compile char_item.cpp
compile char_manager.cpp
compile char_quickslot.cpp
compile char_resist.cpp
compile char_skill.cpp
compile char_state.cpp
compile PetSystem.cpp
compile cmd.cpp
compile cmd_emotion.cpp
compile cmd_general.cpp
compile cmd_gm.cpp
compile config.cpp
compile cmd_oxevent.cpp
compile constants.cpp
compile crc32.cpp
compile cube.cpp
compile db.cpp
compile db.cpp
compile desc.cpp
compile desc_client.cpp
compile desc_manager.cpp
compile desc_p2p.cpp
compile dev_log.cpp
compile dungeon.cpp
compile empire_text_convert.cpp
compile entity.cpp
compile entity_view.cpp
compile event.cpp
compile event_queue.cpp
compile exchange.cpp
compile file_loader.cpp
compile fishing.cpp
compile gm.cpp
compile guild.cpp
compile guild_manager.cpp
compile guild_war.cpp
compile horse_rider.cpp
compile horsename_manager.cpp
compile input.cpp
guild_manager.cpp:287:36compile input_auth.cpp
: error: no template named 'binary_function' in namespace 'std'; did you mean '__binary_function'?
  287 | struct FGuildCompare : public std::binary_function<CGuild*, CGuild*, bool>
      |                               ~~~~~^~~~~~~~~~~~~~~
      |                                    __binary_function
/usr/include/c++/v1/__functional/binary_function.h:49:1: note: '__binary_function' declared here
   49 | using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
      | ^
compile input_db.cpp
1 error generated.
gmake: *** [Makefile:102: OBJDIR/guild_manager.o] Error 1
gmake: *** Waiting for unfinished jobs....

 

 

linking ../game....
Moving ../game to /usr/metin2/server/share/bin
All done! Your game file moved to your server directory.

 

and also changed it and then i was able to compile the game successfully. i've restarted the server and I was able to join and play. Should I also change the client source? i don't know if it brings any problem/bug/errors?

 

I'd love to hear your opinions.

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

3 hours ago, TheEqualizer said:

Which C++ version are you using? std::unary_function and std::binary_function were removed in C++ 17.

 

automake-1.16.5                GNU Standards-compliant Makefile generator
cmake-3.26.1                   Meta-port to connect all CMake bits
cmake-core-3.26.1_1            Cross-platform Makefile generator
cmake-doc-3.26.1               HTML and Qt Creator helpfiles for CMake
cmake-man-3.26.1               Manual pages for CMake
gdb-13.1_2                     GNU Project Debugger
gmake-4.3_2                    GNU version of 'make' utility
llvm-devel-17.0.d20230711      LLVM and Clang
makedepend-1.0.6,1             Dependency generator for makefiles

 

llvm-devel-17.0.d20230711      LLVM and Clang          // looks like version 17.

 

so no problem with changing "unary_function" to "__unary_function" ?

 

thank you for your response.

Link to comment
Share on other sites

I meant the version of the C++ standard you set in the compiler (valid versions should be C++ 98, C++ 11, C++ 14, C++ 17, C++ 20, C++23 and C++26). If you are using C++ 17 or higher then std::unary_function (and friends) won't be available.

I don't know how (or why) you are using std::unary_function (and its friends), but you don't need it. You can use functors, lambdas, std::function or std::bind.

Link to comment
Share on other sites

17 hours ago, TheEqualizer said:

I meant the version of the C++ standard you set in the compiler (valid versions should be C++ 98, C++ 11, C++ 14, C++ 17, C++ 20, C++23 and C++26). If you are using C++ 17 or higher then std::unary_function (and friends) won't be available.

I don't know how (or why) you are using std::unary_function (and its friends), but you don't need it. You can use functors, lambdas, std::function or std::bind.

I don't know either.. Like i said before, it is [40250] Reference Serverfile + Client + Src [15 Available Languages] by TMP4 files. I did not even edit anything in the code. This is the file (src/common/stl.h)

Spoiler
#ifndef __INC_METIN_II_STL_H__
#define __INC_METIN_II_STL_H__

#include <vector>
#include <string>
#include <map>
#include <list>
#include <functional>
#include <stack>
#include <set>
// #ifdef __GNUC__
// #include <ext/functional>
// #endif

#ifndef itertype
#define itertype(v) __typeof((v).begin())
#endif

inline void stl_lowers(std::string& rstRet)
{
        for (size_t i = 0; i < rstRet.length(); ++i)
                rstRet[i] = tolower(rstRet[i]);
}

struct stringhash
{
        size_t operator () (const std::string & str) const
        {
                const unsigned char * s = (const unsigned char*) str.c_str();
                const unsigned char * end = s + str.size();
                size_t h = 0;

                while (s < end)
                {
                        h *= 16777619;
                        h ^= *(s++);
                }

                return h;
        }
};

// code from tr1/functional_hash.h
template<typename T>
struct hash;

template<typename _Tp>
struct hash<_Tp*>
: public std::unary_function<_Tp*, std::size_t>
{
        std::size_t
                operator()(_Tp* __p) const
                { return reinterpret_cast<std::size_t>(__p); }
};

namespace std
{
        template <class container, class Pred>
                void erase_if (container & a, typename container::iterator first, typename container::iterator past, Pred pred)
                {
                        while (first != past)
                                if (pred(*first))
                                        a.erase(first++);
                                else
                                        ++first;
                }

        template <class container>
                void wipe(container & a)
                {
                        typename container::iterator first, past;

                        first = a.begin();
                        past = a.end();

                        while (first != past)
                                delete *(first++);

                        a.clear();
                }

        template <class container>
                void wipe_second(container & a)
                {
                        typename container::iterator first, past;

                        first = a.begin();
                        past = a.end();

                        while (first != past)
                        {
                                delete first->second;
                                ++first;
                        }

                        a.clear();
                }

        // 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;
        // }

        template <class _Ty>
                class void_mem_fun_t : public unary_function<_Ty *, void>
                {
                        public:
                                explicit void_mem_fun_t(void (_Ty::*_Pm)()) : _Ptr(_Pm)
                                {
                                }

                                void operator()(_Ty* p) const
                                {
                                        ((p->*_Ptr)());
                                }

                        private:
                                void (_Ty::*_Ptr)();
                };

        template<class _Ty> inline
                void_mem_fun_t<_Ty> void_mem_fun(void (_Ty::*_Pm)())
                { return (void_mem_fun_t<_Ty>(_Pm)); }

        template<class _Ty>
                class void_mem_fun_ref_t : public unary_function<_Ty, void>
                {
                        public:
                                explicit void_mem_fun_ref_t(void (_Ty::*_Pm)()) : _Ptr(_Pm) {}
                                void operator()(_Ty& x) const
                                { return ((x.*_Ptr)()); }
                        private:
                                void (_Ty::*_Ptr)();
                };

        template<class _Ty> inline
                void_mem_fun_ref_t<_Ty> void_mem_fun_ref(void (_Ty::*_Pm)())
                { return (void_mem_fun_ref_t< _Ty>(_Pm)); }
};

#endif

 

Link to comment
Share on other sites

  • Solution

The problem isn't the source files, it's how you configured your C++ compiler.

You have to set the C++ version to 11 or 14, because as I said, std::unary_function was removed in C++ 17.

Again, you don't need to change anything in the compiler because you can replace std::unary_function with one of the modern alternatives I gave.

Link to comment
Share on other sites

32 minutes ago, TheEqualizer said:

The problem isn't the source files, it's how you configured your C++ compiler.

You have to set the C++ version to 11 or 14, because as I said, std::unary_function was removed in C++ 17.

Again, you don't need to change anything in the compiler because you can replace std::unary_function with one of the modern alternatives I gave.

Ohhh, OK. Thank you so much for your help. Have great day.. 👍

Link to comment
Share on other sites

  • 4 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.