Category "c++"

Can we use multiple stack in Qt's Undo Framework (Command Pattern )

I am having a QgraphicsView which contains multiple QGraphicsItem. I have some features like zoom-in, zoom-out, Hide - Unhide selected item, Undo-Redo. To imple

Main thread usage loop advise needed

Im building an app on Linux in C++, and I find it convenient to move all periodic tasks to other threads. This is my first multi-threaded Linux app(and basicall

Inheriting a class and re-using its constructors issue missing in the base class

In the following program, struct B has two user-defined constructors: one from int and another from int&& (clearly this is not very practical). And an o

Why use devnull with subprocess.check_output in python2?

I have inherited a complicated (to me) toolbox from a PhD student before me and it uses python2 instead of 3 since it's older. The main file is in python2 and u

Maximum Frequency Number in an array using Hashmaps

Problem: You are given an array of integers that contain numbers in random order. Write a program to find and return the number which occurs the maximum

I'm Trying to open a stream in PortAudio

i'm using this api: Pa_OpenStream() // Open line-in stream err = Pa_OpenStream(&m_stream, &m_inputParameters, &

Trouble getting gtkmm-4.0 to work on macOS Monterey

I'm having trouble getting gtkmm-4.0 to work on Mac OS Monterey. Here is a simple C++ application that uses gtkmm4. // helloworld.cpp #include <gtkmm.h>

How can I get a consistent, unique, identifier for a unique class combination?

I need a way to identify a unique combination of template types that gives me an easily indexable identifier. I have the following class: #include <cstdint&g

Qt: Qt 6.1.1 Failed to create vertex shader: Error 0x80070057

Guys! I'm a new user of qt and I faced a problem with qml. This issue has already been discussed in this article, but for python. I write in C ++/Qt 6.1.1, QtCr

How to initialize a struct to 0 in C++

Here is a related C answer that doesn't work (as a zero initializer for a struct) in C++: Initializing a struct to 0. One of the solutions presented is this: my

Visual Studio Code: how to add arguments for g++ compiler?

I want to use some C++17 features that Mac's clang doesn't currently support, so I use brew install gcc --HEAD to install the g++ 10.0.1 version. Codes run w

Why reading MachineGUID is a virus?

Why is it that when I read SOFTWARE\Microsoft\Cryptography\MachineGuid from the registry, my program is detected by the Windows Defender as a virus?

cmake: statically link against opencv libs

On Ubuntu 20.04: sudo apt install libopencv-dev Result: kwu@Dev-KWu:/usr$ find . -name "*opencv_imgproc*" -o -name "*opencv_core*" ./lib/x86_64-linux-gnu/libope

How do i hide the bug image once its hit by a bullet in opengl and c++

I am working on defender/space invaders game. I have drawn bug sprite and a bullet sprite. I shoot at the bug with a bullet but when the bullet hits the bug it

OOP sobreencapsulation

Lately I've been learning something about blockchain and I decided to try to make one in c++, without libraries that were made specifically for that, just with

What is an undefined reference/unresolved external symbol error and how do I fix it?

What are undefined reference/unresolved external symbol errors? What are common causes and how to fix/prevent them?

my compiler gives an error E0393 using a pointer to an incomplete type of the "String" class::Srep" is not allowed in inline functions

I tried to write a custom type from a book, my compiler gives an error E0393 using a pointer to an incomplete type of the "String" class::Srep" is not allowed i

Refreshing a Variable multiple times a frame(for a texture array in a shader)

I want to Update an integer multiple times in frame so that the fragment-shader can access the right index of a texture array for different objects. I first tri

Poco addRecursive Not Returning to Normal Program Flow

I implemented Poco in my C++ application for Windows in VS 2019 using tips from this post: How to use Poco::ZIP to compress/decompress zip file I have figured o

What does this char string related piece of C++ code do?

bool check(const char *text) { char c; while (c = *text++) { if ((c & 0x80) && ((*text) & 0x80)) { return true;