Çözüldü GCC 8 / C++17 / MariaDB Güncelleme build hatası

  • Konuyu açan Konuyu açan beqkral
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 3
  • Gösterim Gösterim 581
Bu konu çözüme ulaştırılmıştır. Çözüm için konuya yazılan tüm yorumları okumayı unutmayın. Eğer konudaki yorumlar sorununuzu çözmediyse yeni bir konu açabilirsiniz.
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.

beqkral

MT Üye
MT Üye
Mesaj
204
Çözümler
15
Beğeni
55
Puan
464
Ticaret Puanı
0
Merhabalar ,
2 günden beri uğraşıyorum sonunda gcc8 ve c++17 ye geçirdim tüm externleri tekrar kurup build aldım

db , libgame , liblua , libpoly , libsql , libthecore bunlarıda sorunsuz build edebiliyorum
sadece game build ederken şöyle bir hata alıyorum..
gmake build:
Genişlet Daralt Kopyala
utils.cpp: In function 'std::__cxx11::string mysql_hash_password(const char*)':
utils.cpp:34:2: error: 'make_scrambled_password' was not declared in this scope
  make_scrambled_password(hash_buf, tmp_pwd);
  ^~~~~~~~~~~~~~~~~~~~~~~
utils.cpp:34:2: note: suggested alternative: 'ma_make_scrambled_password'
  make_scrambled_password(hash_buf, tmp_pwd);
  ^~~~~~~~~~~~~~~~~~~~~~~
  ma_make_scrambled_password
utils.cpp: In function 'void split_argument(const char*, std::vector<std::__cxx11::basic_string<char> >&)':
utils.cpp:168:9: error: 'split' is not a member of 'boost'
  boost::split(vecArgs, arg, boost::is_any_of(" "), boost::token_compress_on);
         ^~~~~
utils.cpp:168:36: error: 'is_any_of' is not a member of 'boost'
  boost::split(vecArgs, arg, boost::is_any_of(" "), boost::token_compress_on);
                                    ^~~~~~~~~
utils.cpp:168:59: error: 'token_compress_on' is not a member of 'boost'
  boost::split(vecArgs, arg, boost::is_any_of(" "), boost::token_compress_on);
                                                           ^~~~~~~~~~~~~~~~~
gmake: *** [Makefile:181: ../../bin/objdir/game/utils.o] Error 1

utils.cpp:
Genişlet Daralt Kopyala
#include "stdafx.h"

static int global_time_gap = 0;

time_t get_global_time()
{
    return time(0) + global_time_gap;
}

void set_global_time(time_t t)
{
    global_time_gap = t - time(0);

    char time_str_buf[32];
    snprintf(time_str_buf, sizeof(time_str_buf), "%s", time_str(get_global_time()));

    sys_log(0, "GLOBAL_TIME: %s time_gap %d", time_str_buf, global_time_gap);
}

#ifndef __WIN32__
#include <mysql/mysql.h>
#ifndef SHA1_HASH_SIZE
#define SHA1_HASH_SIZE 20
#endif
#ifdef WIN32
extern "C" void my_make_scrambled_password(char *to, const char *password, size_t pass_len);
#endif
std::string mysql_hash_password(const char* tmp_pwd)
{
    char hash_buf[2*SHA1_HASH_SIZE + 2] = "";
#ifdef WIN32
    my_make_scrambled_password(hash_buf, tmp_pwd, strlen(tmp_pwd));
#else
    make_scrambled_password(hash_buf, tmp_pwd);
#endif
    return hash_buf;
}
#endif

int dice(int number, int size)
{
    int sum = 0, val;

    if (size <= 0 || number <= 0)
        return (0);

    while (number)
    {
        val = ((thecore_random() % size) + 1);
        sum += val;
        --number;
    }

    return (sum);
}

size_t str_lower(const char * src, char * dest, size_t dest_size)
{
    size_t len = 0;

    if (!dest || dest_size == 0)
        return len;

    if (!src)
    {
        *dest = '\0';
        return len;
    }

    // \0 ?? ??
    --dest_size;

    while (*src && len < dest_size)
    {
        *dest = LOWER(*src); // LOWER ????? ++? --?? ??!!

        ++src;
        ++dest;
        ++len;
    }

    *dest = '\0';
    return len;
}

void skip_spaces(const char **string)
{
    for (; **string != '\0' && isnhspace(**string); ++(*string));
}

const char *one_argument(const char *argument, char *first_arg, size_t first_size)
{
    char mark = FALSE;
    size_t first_len = 0;

    if (!argument || 0 == first_size)
    {
        sys_err("one_argument received a NULL pointer!");
        *first_arg = '\0';
        return NULL;
    }


    --first_size;

    skip_spaces(&argument);

    while (*argument && first_len < first_size)
    {
        if (*argument == '\"')
        {
            mark = !mark;
            ++argument;
            continue;
        }

        if (!mark && isnhspace(*argument))
            break;

        *(first_arg++) = *argument;
        ++argument;
        ++first_len;
    }

    *first_arg = '\0';

    skip_spaces(&argument);
    return (argument);
}

const char *two_arguments(const char *argument, char *first_arg, size_t first_size, char *second_arg, size_t second_size)
{
    return (one_argument(one_argument(argument, first_arg, first_size), second_arg, second_size));
}

const char * three_arguments(const char * argument, char * first_arg, size_t first_size, char * second_arg, size_t second_size, char * third_arg, size_t third_size)
{
    return (one_argument(one_argument(one_argument(argument, first_arg, first_size), second_arg, second_size), third_arg, third_size));
}

const char * six_arguments(const char * argument, char * first_arg, size_t first_size, char * second_arg, size_t second_size, char * third_arg, size_t third_size, char * four_arg, size_t four_size, char * five_arg, size_t five_size, char * six_arg, size_t six_size)
{
    return (one_argument(one_argument(one_argument(one_argument(one_argument(one_argument(argument, first_arg, first_size), second_arg, second_size), third_arg, third_size), four_arg, four_size), five_arg, five_size), six_arg, six_size));
}

const char *first_cmd(const char *argument, char *first_arg, size_t first_arg_size, size_t *first_arg_len_result)
{
    size_t cur_len = 0;
    skip_spaces(&argument);
    first_arg_size -= 1;

    while (*argument && !isnhspace(*argument) && cur_len < first_arg_size)
    {
        *(first_arg++) = LOWER(*argument);
        ++argument;
        ++cur_len;
    }

    *first_arg_len_result = cur_len;
    *first_arg = '\0';
    return (argument);
}

#ifdef WJ_ELDER_ATTRIBUTE_SYSTEM
void split_argument(const char *argument, std::vector<std::string> & vecArgs)
{
    std::string arg = argument;
    boost::split(vecArgs, arg, boost::is_any_of(" "), boost::token_compress_on);
}
#endif

int CalculateDuration(int iSpd, int iDur)
{
    int i = 100 - iSpd;

    if (i > 0)
        i = 100 + i;
    else if (i < 0)
        i = 10000 / (100 - i);
    else
        i = 100;

    return iDur * i / 100;
}

double uniform_random(double a, double b)
{
    return thecore_random() / (RAND_MAX + 1.f) * (b - a) + a;
}

float gauss_random(float avg, float sigma)
{
    static bool haveNextGaussian = false;
    static float nextGaussian = 0.0f;

    if (haveNextGaussian)
    {
        haveNextGaussian = false;
        return nextGaussian * sigma + avg;
    }
    else
    {
        double v1, v2, s;
        do {
            v1 = uniform_random(-1.f, 1.f);
            v2 = uniform_random(-1.f, 1.f);
            s = v1 * v1 + v2 * v2;
        } while (s >= 1.f || fabs(s) < FLT_EPSILON);
        double multiplier = sqrtf(-2 * logf(s)/s);
        nextGaussian = v2 * multiplier;
        haveNextGaussian = true;
        return v1 * multiplier * sigma + avg;
    }
}

int parse_time_str(const char* str)
{
    int tmp = 0;
    int secs = 0;

    while (*str != 0)
    {
        switch (*str)
        {
            case 'm':
            case 'M':
                secs += tmp * 60;
                tmp = 0;
                break;

            case 'h':
            case 'H':
                secs += tmp * 3600;
                tmp = 0;
                break;

            case 'd':
            case 'D':
                secs += tmp * 86400;
                tmp = 0;
                break;

            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                tmp *= 10;
                tmp += (*str) - '0';
                break;

            case 's':
            case 'S':
                secs += tmp;
                tmp = 0;
                break;
            default:
                return -1;
        }
        ++str;
    }

    return secs + tmp;
}

bool WildCaseCmp(const char *w, const char *s)
{
    for (;;)
    {
        switch(*w)
        {
            case '*':
                if ('\0' == w[1])
                    return true;
                {
                    for (size_t i = 0; i <= strlen(s); ++i)
                    {
                        if (true == WildCaseCmp(w + 1, s + i))
                            return true;
                    }
                }
                return false;

            case '?':
                if ('\0' == *s)
                    return false;

                ++w;
                ++s;
                break;

            default:
                if (*w != *s)
                {
                    if (tolower(*w) != tolower(*s))
                        return false;
                }

                if ('\0' == *w)
                    return true;

                ++w;
                ++s;
                break;
        }
    }

    return false;
}

bool is_digits(const std::string &str)
{
    return str.find_first_not_of("0123456789") == std::string::npos;
}
//
utils.h:
Genişlet Daralt Kopyala
#ifndef __INC_METIN_II_UTILS_H__
#define __INC_METIN_II_UTILS_H__

#include <math.h>
#include <sstream>
#include <iostream>
#include <stdint.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>

#define IS_SET(flag, bit)        ((flag) & (bit))
#define SET_BIT(var, bit)        ((var) |= (bit))
#define REMOVE_BIT(var, bit)    ((var) &= ~(bit))
#define TOGGLE_BIT(var, bit)    ((var) = (var) ^ (bit))

inline float DISTANCE_SQRT(long dx, long dy)
{
    return ::sqrt((float)dx * dx + (float)dy * dy);
}

inline int DISTANCE_APPROX(int dx, int dy)
{
    int min, max;

    if (dx < 0)
        dx = -dx;

    if (dy < 0)
        dy = -dy;

    if (dx < dy)
    {
        min = dx;
        max = dy;
    }
    else
    {
        min = dy;
        max = dx;
    }

    // coefficients equivalent to ( 123/128 * max ) and ( 51/128 * min )
    return ((( max << 8 ) + ( max << 3 ) - ( max << 4 ) - ( max << 1 ) +
        ( min << 7 ) - ( min << 5 ) + ( min << 3 ) - ( min << 1 )) >> 8 );
}

#ifndef __WIN32__
inline WORD MAKEWORD(BYTE a, BYTE b)
{
    return static_cast<WORD>(a) | (static_cast<WORD>(b) << 8);
}
#endif

extern void set_global_time(time_t t);
extern time_t get_global_time();

#include <string>
std::string mysql_hash_password(const char* tmp_pwd);

extern int    dice(int number, int size);
extern size_t str_lower(const char * src, char * dest, size_t dest_size);

extern void    skip_spaces(char **string);

extern const char *    one_argument(const char *argument, char *first_arg, size_t first_size);
extern const char *    two_arguments(const char *argument, char *first_arg, size_t first_size, char *second_arg, size_t second_size);
extern const char * three_arguments(const char * argument, char * first_arg, size_t first_size, char * second_arg, size_t second_size, char * third_flag, size_t third_size);
extern const char * six_arguments(const char * argument, char * first_arg, size_t first_size, char * second_arg, size_t second_size, char * third_flag, size_t third_size, char * four_flag, size_t four_size, char * five_flag, size_t five_size, char * six_flag, size_t six_size);
extern const char *    first_cmd(const char *argument, char *first_arg, size_t first_arg_size, size_t *first_arg_len_result);

#ifdef WJ_ELDER_ATTRIBUTE_SYSTEM
extern void split_argument(const char *argument, std::vector<std::string> & vecArgs);
#endif

extern int CalculateDuration(int iSpd, int iDur);

extern float gauss_random(float avg = 0, float sigma = 1);

extern int parse_time_str(const char* str);

extern bool WildCaseCmp(const char *w, const char *s);

extern bool is_digits(const std::string &str);

#endif /* __INC_METIN_II_UTILS_H__ */


yardımlarınızı bekliyorum
 
Aklıma ilk olarak boost sürümü geldi. Hangi sürümü kullanıyorsun?
 
hata:
Genişlet Daralt Kopyala
utils.cpp:168:36: error: 'is_any_of' is not a member of 'boost'
  boost::split(vecArgs, arg, boost::is_any_of(" "), boost::token_compress_on);
                                    ^~~~~~~~~
utils.cpp:168:59: error: 'token_compress_on' is not a member of 'boost'
  boost::split(vecArgs, arg, boost::is_any_of(" "), boost::token_compress_on);

Hatasında is_any_of ve token_compress_on boost'ın üyesi değil diyor. yorum yapmak için paylaşılan kod çok kısıtlı. Boost class'ının içeriğini atabilirsen yardımcı olmaya çalışırım.
 
make_scrambled_password utils.cpp bu kod bloğunu kaldırınca düzeldi konu kapatılabilir.
 
Çözüm
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.
Geri
Üst