Build Errors

Fix common compiler and toolchain issues when building Gurotopia

Build Errors

If you get a format error while building, like this:

akio@ubuntu ~
 make -j$(nproc)
g++ -std=c++2b -g -Iinclude -MMD -MP -Iinclude -x c++-header include/pch.hpp -o build/pch.gch
include/pch.hpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
g++ -std=c++2b -g -Iinclude -MMD -MP -c main.cpp -o build/main.o
g++ -std=c++2b -g -Iinclude -MMD -MP -c include/action/__action.cpp -o build/include/action/__action.o
g++ -std=c++2b -g -Iinclude -MMD -MP -c include/action/buy.cpp -o build/include/action/buy.o
g++ -std=c++2b -g -Iinclude -MMD -MP -c include/action/dialog_return.cpp -o build/include/action/dialog_return.o
include/action/buy.cpp: In function ‘void action::buy(ENetEvent&, const string&, std::string_view)’:
include/action/buy.cpp:39:22: error: ‘format’ is not a member of ‘std’
   39 |                 std::format(
      |                      ^~~~~~
include/action/buy.cpp:45:18: error: ‘format’ is not a member of ‘std’
   45 |             std::format(
      |                  ^~~~~~
include/action/buy.cpp:62:42: error: ‘format’ is not a member of ‘std’
   62 |                 StoreRequest.append(std::format(
      |                                          ^~~~~~
include/action/buy.cpp:68:58: error: ‘format’ is not a member of ‘std’
   68 |         if (!selection.empty()) StoreRequest.append(std::format("select_item|{}\\n", selection));
      |                                                          ^~~~~~
include/action/buy.cpp:87:30: error: ‘format’ is not a member of ‘std’
   87 |                         std::format("You can't afford `0{}``!  You're `${}`` Gems short.",
      |                              ^~~~~~
include/action/buy.cpp:89:30: error: ‘format’ is not a member of ‘std’
   89 |                         std::format("You can't afford `0{}``!  You're `${}`` `2Growtokens`` short.",
      |                              ^~~~~~

Check your GCC version first:

gcc --version
g++ --version

If your GCC version is under 13, update it.

The std::format feature used by Gurotopia requires a newer GCC toolchain. GCC 13 or newer is recommended.

For Ubuntu, run:

# add gcc repository
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update

# install gcc 13
sudo apt install gcc-13 g++-13

# set gcc 13 as default
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 130
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 130
sudo update-alternatives --config gcc
sudo update-alternatives --config g++

# verify
gcc --version
g++ --version

If you run into a build error that is not listed on this page, join the Discord community and report the error or bug there. You can also ask for help if you are not sure what is causing it.