Problem with C++ uniform_int_distribution.h on MacOS (VSCode)

If you have worked with C++ on MacOS for some time now,
I would really appreciate your help.

You see, I have been running into some annoying errors regarding random numerics.
I am trying to create a maze game were you have to figure out how to get through the maze without seeing it as a whole. I’m also trying to brighten it up with some colour.

It creates a random colour scheme for every game, I’m not sure how it might look but it’s about time I’d give you my code:

(Keep in mind, I haven’t finished it yet, I’m porting it from my first attempt in C)

/*
 *  Copyright (c) 2024 Thom Cumming
 *  Under the Apache version 2.0 software license.
 *  https://www.apache.org/licenses/LICENSE-2.0
 *  -----------------------------------------------------------------------------------
 *  I am currently interested in coding, math and graphics;
 *  So I thought it would be nice to revisit my age old dream of creating a maze game.
 * 
 *  Please don't hesitate, by any means to do what ever the Apache 2.0 license permits.
 *  (like steal my car, or ruin my tooth brush... Naa!)
 *
 */

 /*
  *  Since this is a simple project, I am going to be using iostream and other such C++ utilities--
  *  There would be faster ways of doing what it can do (at run time... Ha ha ha!), but cout and cin are much more readable.
  *  It would also be much safer than stdio.h
  */
#include <algorithm>      /* Various multi-computational related functions */
#include <iostream>       /* IO tasks, good for simple logging */
#include <random>         /* Random arguments for color, geometry, and such */
#include <vector>         /* Vectors opposed to arrays */
#include <unordered_map>  /* Mapping information in a way that is searchable */

  /*
   *  Tigr is a free game graphics library for C/C++ in the public domain;
   *  I am using it as a replacement for the OLC Pixel Game Engine, because of it being designed for MacOS
   *  Check it out here:
   */
#include "tigr.h" // Roar!!!!

   /*
    *  To prevent the editors of this code that are also XCode users--
    *  We must define the OBJC_OLD_DISPATCH_PROTOTYPES macro.
    *  It might seem like a daft move to make but since Tigr is multi platform, so we might as well follow the same tradition...
    */

#ifndef OBJC_OLD_DISPATCH_PROTOTYPES
#define OBJC_OLD_DISPATCH_PROTOTYPES
#endif

    /*
     *  Again since this is a fun project, we can enjoy the prospect of less typing work to do.
     *  I am a kind of a "work smarter, not harder" person.
     *  Allthough I do like to work hard.
     */
using namespace std;
/*
 *  Define the value of Phi, it is a mathematical constant that when multiplied by the shorter side of a rectangle makes it geometrically appealing.
 *  This is important given that we are making a game.
 *  It needs to make you happy, in every way possible.
 */
#define PHI 1.4472135954999579

 /*  As well as have a defintion of Phi as a floating point,
  *  I thought it would probably be good to have a constexpr function implementation of it.
  *  This function will multiply its input by the formula of Phi:
  */
float phi(float x)
{
    return 1 + 1 / sqrtf(5.0) * x;
}

/*
 *  This other macro, is also related to Phi.
 *  But it assists the task of generating random color schemes,
 *  Of course, color schemes are not color schemes if they are not appealing.
 *  It defines the smallest possible ratio of phi under 256 (11111111)
 */
#define SMALLEST_PHI_RGB 1.0110979572956067

 /*
  *  A class that helps abstract the notion of color throughout the course of this program.
  *  It makes it easier to document, read, and understand, to the average coder, as well as myself.
  *  I hope you find it that way!
  */
class Color
{
private:


    /* A good way to represent RGB values, aka colors */
    typedef vector<u_int8_t> RGBValue;

    /*
     *  This function allows for there to be different color schemes for the maze per round,
     *  I feel that games cannot be dull and need some interesting artistic features, especially this one.
     *  Please give me any suggestions that comes to mind, I would be delighted to hear any of your questions or feedback.
     */
    static RGBValue Random()
    {


        RGBValue result;


        /* Create a decsent random seed */
        mt19937 rng(random_device{}()); // <- PROBLEM
        /* Set the range to 255, aka, the maximum value of an eight bit integer */
        uniform_int_distribution<> range(0, 255); // <- PROBLEM

        /* Create the result of this function */
        for (int iter = 0; iter < 3; iter++)
        {

            u_int8_t rand_rgb = range(rng)'
            result.push_back(rand_rgb);

        }

        /*
         *  Fun fact:
         *  There is about a one out of 4.633615e+121 chance that any color is to emerge as opposed to all the other possiblities;
         *  That means each random color scheme for our game is going to be wildly diverse.
         */

        return result;
    }



    friend class ColorScheme;



public:


    RGBValue value;


    Color(RGBValue initialize = Random())
    {
        this->value = initialize;
    }





};



class ColorScheme : Color
{
};

int main(void)
{

    return 0;
}

And here are the error messages:

Executing task: g++ -Wall -Wextra -g3 /Users/thomcumming/Desktop/MazeGame/main.cpp -o /Users/thomcumming/Desktop/MazeGame/output/main

/Users/thomcumming/Desktop/MazeGame/main.cpp:98:34: error: expected ‘)’
mt19937 rng(random_device{}());
^
/Users/thomcumming/Desktop/MazeGame/main.cpp:98:20: note: to match this ‘(‘
mt19937 rng(random_device{}());
^
In file included from /Users/thomcumming/Desktop/MazeGame/main.cpp:19:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:1893:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/ranges_sample.h:13:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/sample.h:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__random/uniform_int_distribution.h:237:5: error: static assertion failed due to requirement ‘__libcpp_random_is_valid_urng<std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> (std::random_device), void>::value’:
static_assert(__libcpp_random_is_valid_urng<_URNG>::value, “”);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:624:32: note: expanded from macro ‘static_assert’

define static_assert(…) _Static_assert(VA_ARGS)

                           ^              ~~~~~~~~~~~

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__random/uniform_int_distribution.h:207:17: note: in instantiation of function template specialization ‘std::uniform_int_distribution<>::operator()<std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> (std::random_device)>’ requested here
{return (*this)(__g, _p);}
^
/Users/thomcumming/Desktop/MazeGame/main.cpp:107:38: note: in instantiation of function template specialization ‘std::uniform_int_distribution<>::operator()<std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> (std::random_device)>’ requested here
u_int8_t rand_rgb = range(rng);
^
In file included from /Users/thomcumming/Desktop/MazeGame/main.cpp:19:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:1893:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/ranges_sample.h:13:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/sample.h:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__random/uniform_int_distribution.h:40:22: error: type ‘std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> (std::random_device)’ cannot be used prior to ‘::’ because it has no members
typedef typename _Engine::result_type _Engine_result_type;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__random/uniform_int_distribution.h:246:41: note: in instantiation of template class ‘std::__independent_bits_engine<std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> (std::random_device), unsigned int>’ requested here
return static_cast<result_type>(_Eng(__g, __dt)());
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__random/uniform_int_distribution.h:207:17: note: in instantiation of function template specialization ‘std::uniform_int_distribution<>::operator()<std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> (std::random_device)>’ requested here
{return (*this)(__g, _p);}
^
/Users/thomcumming/Desktop/MazeGame/main.cpp:107:38: note: in instantiation of function template specialization ‘std::uniform_int_distribution<>::operator()<std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> (std::random_device)>’ requested here
u_int8_t rand_rgb = range(rng);
^
In file included from /Users/thomcumming/Desktop/MazeGame/main.cpp:19:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:1893:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/ranges_sample.h:13:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/sample.h:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__random/uniform_int_distribution.h:55:45: error: type ‘std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> (std::random_device)’ cannot be used prior to ‘::’ because it has no members
static const _Working_result_type _Rp = _Engine::_Max – _Engine::_Min
^
4 errors generated.

  • The terminal process “g++ ‘-Wall’, ‘-Wextra’, ‘-g3’, ‘/Users/thomcumming/Desktop/MazeGame/main.cpp’, ‘-o’, ‘/Users/thomcumming/Desktop/MazeGame/output/main'” terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

I was expecting a clear terminal.

New contributor

user24371560 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật