Author Archives: dmitriano

Creating a puzzle game cell with Proportional Editing in Blender

Add->Mesh->Plane, Subdivide 100:


Creating a puzzle game cell in Blender

Two transformed cubes:


Created a cube in Blender

I created a cube in Blender 3.6.5:


Compiling a single C++ source file in QT Creator

My QT Creator builds an Android app with the following command:

"D:\dev\tools\cmake-3.24.2-windows-x86_64\bin\cmake.exe" --build D:/dev/repos/tradeclient/src/build-TradeClient-Android_Qt_6_5_2_arm64_v8a_debug_Clang_arm64_v8a-Debug --target all

I simply started Windows Command Prompt and was able to run the following commands:

set PATH=%PATH%;C:\Qt\qtcreator-10.0.2\bin\jom
cd D:\dev\repos\tradeclient\src\build-TradeClient-Android_Qt_6_5_2_arm64_v8a_debug_Clang_arm64_v8a-Debug
"D:\dev\tools\cmake-3.24.2-windows-x86_64\bin\cmake.exe" --build . --target BotFactory.cpp.o
"D:\dev\tools\cmake-3.24.2-windows-x86_64\bin\cmake.exe" --build . --target ExchangeModel.cpp.o > my.txt 2>&1
"D:\dev\tools\cmake-3.24.2-windows-x86_64\bin\cmake.exe" --build . --target Bots/ShortBot.cpp.o > my2.txt 2>&1

Testing my internet connection with Ping Plotter

Connection to with Rostelecom provider:


What is the type of a string literal in C++?

The code below compiles and the asserts do not fail:

#include <iostream>

int main()
    auto a = "str";
    const auto& ar = "str";
    const char* b = "str";
    auto const &c = a;
    auto* d = &a;
    const auto e = 2;

    static_assert(std::is_same_v<const char(&)[4], decltype("str")>);
    static_assert(std::is_same_v<const char*, decltype(a)>);
    static_assert(std::is_same_v<const char(&)[4], decltype(ar)>);
    static_assert(std::is_same_v<const char* const&, decltype(c)>);
    static_assert(std::is_same_v<const char**, decltype(d)>);
    static_assert(std::is_same_v<const int, decltype(e)>);

    std::cout << "a: " << typeid(a).name() << std::endl;
    std::cout << "ar: " << typeid(ar).name() << std::endl;
    std::cout << "b: " << typeid(b).name() << std::endl;
    return 0;

And a and b have identical typeids.

Installing GCC13 on Ubuntu 22.04

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-13 g++-13
ll /usr/bin/gcc-13
ll /usr/bin/g++-13
update-alternatives --display gcc
ll /etc/alternatives/g*
sudo update-alternatives --remove-all gcc 
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10 --slave /usr/bin/g++ g++ /usr/bin/g++-13
g++ --version
gcc --version

Building QT6.5.2 for X11 on Ubuntu 22.04

In addition to the packages installed while building QT6.4 I installed the following packages required for X11:

sudo apt install libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev \
  libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev \
  libxcb-cursor-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev \
  libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev \
  libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev \
  libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev

And configured QT with dynamic linking:

export MY_INSTALL_PATH=/home/def/libs/QT6.5d
export QT_SRC_PATH=/home/def/repos/qt-everywhere-src-6.5.2

${QT_SRC_PATH}/configure -prefix $MY_INSTALL_PATH -DQT_NO_EXCEPTIONS=1 -debug-and-release -force-debug-info -opensource -confirm-license \
  -c++std c++20 -openssl-linked \
  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity \
  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua \
  -skip qtserialport -skip qtpositioning -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects \
  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard \
  -skip qtwebchannel -skip qtwebengine -skip qtwebview -skip qtquick3dphysics -skip qtspeech -skip qtlocation \
  -skip qthttpserver

An example of overloading operator << in C++

The code below is compiled successfully with both GCC and MSVC:

#include <iostream>
#include <sstream>

template <class C>
class basic_format
    template <typename T>
    basic_format & operator << (const T & val)
        out << val;
        return *this;

    std::basic_string<C> str() const { return out.str(); }

    operator std::basic_string<C>() const { return str(); }

    std::basic_ostringstream<C> out;

App execution aliases on Windows

Turn them off to make Python work: