0

Most of the compiling errors I saw with this problem were on windows using MinGW I am not.

I am using FreeBSD 10.2 stable, gcc 5, c++14.

Below is the error code that is kicked out.

src/map/message.cpp:445:23: error: 'to_string' is not a member of 'std'
     server.append(std::to_string(chatPort));

Here is the actual code of that line and a few after it.

string_t server = "tcp://";
    server.append(chatIp);
    server.append(":");
    server.append(std::to_string(chatPort));

Here is the header file

 #include "../common/socket.h"
 #include "../common/sql.h"
 #include "../common/mmo.h"
 #include <zmq.hpp>
 #include "../common/cbasetypes.h"

 class CBasicPacket;

 struct chat_message_t
{
zmq::message_t* type;
zmq::message_t* data;
zmq::message_t* packet;
};

namespace message
{
void init(const char* chatIp, uint16 chatPort);
void send(MSGSERVTYPE type, void* data, size_t datalen, CBasicPacket*        packet);
void close();
};

Any ideas or help would be greatly appreciated!

Thanks in advance.

Edited Below*

This is my Makefile.am now

## Set automake options
AUTOMAKE_OPTIONS=foreign

## Gather sourcelist
include sources.am


## Set up all of our dependency flags
SRC_ALL                 = $(SRC_DARKSTAR)
CFLAGS_ALL              = $(DARKSTAR_CFLAGS)
CPPFLAGS_ALL            = $(DARKSTAR_CPPFLAGS)
CXXFLAGS_ALL            = $(DARKSTAR_CXXFLAGS)
LIBS_ALL                = $(DARKSTAR_LIBS)
LDFLAGS_ALL             = $(DARKSTAR_LDFLAGS)
CXX                     = g++5 -std=c++14
CC                      = gcc5
CPP                     = gcc5 -E


CFLAGS_ALL              += -std=gnu++14
CFLAGS_ALL              += -std=c++14
CFLAGS_ALL              += $(LUA_CFLAGS)
CFLAGS_ALL              += $(MYSQL_CFLAGS)

LIBS_ALL                += $(LUA_LIBS)
LIBS_ALL                += $(MYSQL_LDFLAGS)
LIBS_ALL                += -lzmq

## Add Architecture-specific stuff
if DARKSTAR_ARCH_LINUX
LIBS_ALL                += -ldl
endif

if DARKSTAR_ARCH_SOLARIS
LIBS_ALL                += -lsocket -lnsl -ldl
endif

if DARKSTAR_ARCH_FREEBSD
CPPFLAGS_ALL            += -D__FREEBSD__
endif

if DARKSTAR_ARCH_NETBSD
CPPFLAGS_ALL            += -D__NETBSD__
endif

if DARKSTAR_ARCH_WIN32
CPPFLAGS_ALL            += -DFD_SETSIZE=4096 -DCYGWIN
endif

## Targets
bin_PROGRAMS          = dsgame dsconnect dssearch

dsgame_SOURCES        = $(SRC_ALL) $(SRC_MAP)
dsgame_CXXFLAGS       = $(CFLAGS_ALL) $(CXXFLAGS_ALL)
dsgame_CPPFLAGS       = $(CPPFLAGS_ALL) -DdsUDPSERV
dsgame_CFLAGS         = $(CFLAGS_ALL)
dsgame_LDFLAGS        = $(LDFLAGS_ALL)
dsgame_LDADD          = $(LIBS_ALL)

dsconnect_SOURCES     = $(SRC_ALL) $(SRC_LOGIN)
dsconnect_CXXFLAGS    = $(CFLAGS_ALL) $(CXXFLAGS_ALL) 
dsconnect_CPPFLAGS    = $(CPPFLAGS_ALL) -DdsTCPSERV 
dsconnect_CFLAGS      = $(CFLAGS_ALL)
dsconnect_LDFLAGS     = $(LDFLAGS_ALL)
dsconnect_LDADD       = $(LIBS_ALL)

dssearch_SOURCES     = $(SRC_SEARCH_COMMON) $(SRC_SEARCH)
dssearch_CXXFLAGS    = $(CFLAGS_ALL) $(CXXFLAGS_ALL)
dssearch_CPPFLAGS    = $(CPPFLAGS_ALL)
dssearch_CFLAGS      = $(CFLAGS_ALL)
dssearch_LDFLAGS     = $(LDFLAGS_ALL)
dssearch_LDADD       = $(LIBS_ALL)
user6031824
  • 189
  • 1
  • 1
  • 4
  • Possibly related: [to_string is not a member of std, says so g++](http://stackoverflow.com/questions/12975341/to-string-is-not-a-member-of-std-says-so-g?rq=1) – crashmstr Mar 08 '16 at 13:53
  • 7
    Has `` been included? – Lingxi Mar 08 '16 at 13:54
  • Or this: [“to_string” isn't a member of “std”?](http://stackoverflow.com/questions/19122574/to-string-isnt-a-member-of-std) – crashmstr Mar 08 '16 at 13:54
  • Please give compiler command (including flags) assuming `#include ` doesn't fix it. – Galik Mar 08 '16 at 14:01
  • make CC=gcc5 CXX=g++5 CPP="gcc5 -E" – user6031824 Mar 08 '16 at 14:11
  • Then in Makefile I have these flags CXX = g++ -std=c++14 CFLAGS_ALL += -std=gnu++14 CFLAGS_ALL += -std=c++14 – user6031824 Mar 08 '16 at 14:12
  • So are you overwriting your `CXX=g++5` command in the `Makefile` which sets it to `g++`? – Galik Mar 08 '16 at 14:19
  • Can you post (cut'n'paste) the command as the `Makefile` executes it? – Galik Mar 08 '16 at 14:21
  • AUTOMAKE_OPTIONS=foreign ## Gather sourcelist include sources.am ## Set up all of our dependency flags SRC_ALL = $(SRC_DARKSTAR) CFLAGS_ALL = $(DARKSTAR_CFLAGS) CPPFLAGS_ALL = $(DARKSTAR_CPPFLAGS) CXXFLAGS_ALL = $(DARKSTAR_CXXFLAGS) LIBS_ALL = $(DARKSTAR_LIBS) LDFLAGS_ALL = $(DARKSTAR_LDFLAGS) CXX = g++ -std=c++14 CFLAGS_ALL += -std=gnu++14 CFLAGS_ALL += -std=c++14 – user6031824 Mar 08 '16 at 14:27
  • Also changing the makefile to g++5 -std=c++14 now – user6031824 Mar 08 '16 at 14:28
  • Added the enitre Makefile.am to original post. Now just using "make" to build. – user6031824 Mar 08 '16 at 23:55

1 Answers1

0
CFLAG_ALL += -D_GLIBCXX_USE_C99
CFLAG_ALL += -D_GLIBCXX_USE_C99_MATH
CFLAG_ALL += -D_GLIBCXX_USE_C99_MATH_TR1

Adding those three lines to my Makefile.am fixed the problem.

## Set automake options
AUTOMAKE_OPTIONS=foreign

## Gather sourcelist
include sources.am


## Set up all of our dependency flags
SRC_ALL                 = $(SRC_DARKSTAR)
CFLAGS_ALL              = $(DARKSTAR_CFLAGS)
CPPFLAGS_ALL            = $(DARKSTAR_CPPFLAGS)
CXXFLAGS_ALL            = $(DARKSTAR_CXXFLAGS)
LIBS_ALL                = $(DARKSTAR_LIBS)
LDFLAGS_ALL             = $(DARKSTAR_LDFLAGS)
CXX                     = g++5 -std=c++14
CC                      = gcc5 -E
CPP                     = gcc5 -E



CFLAGS_ALL              += -D_GLIBCXX_USE_C99
CFLAGS_ALL              += -D_GLIBCXX_USE_C99_MATH
CFLAGS_ALL              += -D_GLIBCXX_USE_C99_MATH_TR1

CFLAGS_ALL              += -std=gnu++14
CFLAGS_ALL              += -std=c++14
CFLAGS_ALL              += $(LUA_CFLAGS)
CFLAGS_ALL              += $(MYSQL_CFLAGS)

LIBS_ALL                += $(LUA_LIBS)
LIBS_ALL                += $(MYSQL_LDFLAGS)
LIBS_ALL                += -lzmq

## Add Architecture-specific stuff
if DARKSTAR_ARCH_LINUX
LIBS_ALL                += -ldl
endif

if DARKSTAR_ARCH_SOLARIS
LIBS_ALL                += -lsocket -lnsl -ldl
endif

if DARKSTAR_ARCH_FREEBSD
CPPFLAGS_ALL            += -D__FREEBSD__
endif

if DARKSTAR_ARCH_NETBSD
CPPFLAGS_ALL            += -D__NETBSD__
endif

if DARKSTAR_ARCH_WIN32
CPPFLAGS_ALL            += -DFD_SETSIZE=4096 -DCYGWIN
endif

## Targets
bin_PROGRAMS          = dsgame dsconnect dssearch

dsgame_SOURCES        = $(SRC_ALL) $(SRC_MAP)
dsgame_CXXFLAGS       = $(CFLAGS_ALL) $(CXXFLAGS_ALL)
dsgame_CPPFLAGS       = $(CPPFLAGS_ALL) -DdsUDPSERV
dsgame_CFLAGS         = $(CFLAGS_ALL)
dsgame_LDFLAGS        = $(LDFLAGS_ALL)
dsgame_LDADD          = $(LIBS_ALL)

dsconnect_SOURCES     = $(SRC_ALL) $(SRC_LOGIN)
dsconnect_CXXFLAGS    = $(CFLAGS_ALL) $(CXXFLAGS_ALL)
dsconnect_CPPFLAGS    = $(CPPFLAGS_ALL) -DdsTCPSERV
dsconnect_CFLAGS      = $(CFLAGS_ALL)
dsconnect_LDFLAGS     = $(LDFLAGS_ALL)
dsconnect_LDADD       = $(LIBS_ALL)

dssearch_SOURCES     = $(SRC_SEARCH_COMMON) $(SRC_SEARCH)
dssearch_CXXFLAGS    = $(CFLAGS_ALL) $(CXXFLAGS_ALL)
dssearch_CPPFLAGS    = $(CPPFLAGS_ALL)
dssearch_CFLAGS      = $(CFLAGS_ALL)
dssearch_LDFLAGS     = $(LDFLAGS_ALL)
dssearch_LDADD       = $(LIBS_ALL)

With the makefile as it is above I only had to type make to build the program. Thank you to those that helped on this.

user6031824
  • 189
  • 1
  • 1
  • 4
  • `-std=gnu++14` and `-std=c++14` are mutually exclusive. Your makefile seems to specify both. (I think when this happens it uses the one that comes last) – M.M Mar 09 '16 at 01:26