Category "c++"

Set working directory for visual studio code for C++ project

I have a C++ project in Visual Studio Code and I am trying to set the working directory so I can do "Assets/model.obj" to access a model instead of having to pa

Reading a vector of maps with yaml-cpp fails

I want to read the following yaml data: camera: response_values: [[0.0: 0.0, 1.0: 1.1, 245.0: 250.1], [0.0: 0.1, 1.0: 1.3, 200.0: 250], [0.0: 0.0, 1.0: 1.1, 24

CMake Error at CMakeLists.txt:7: Parse error. Function missing ending ")". End of file reached

cmake_minimum_required(VERSION 3.0.0) project(opencvtest VERSION 0.1.0) include(CTest) enable_testing() set(OpenCV_DIR C:\Users\Sayar\opencv\build\) find_pac

Calculate length of string object using pointers instead of char arrays

I'm working on an exercise to calculate the length of a string using pointers. Here's the code I've written below: int main() { std::string text = "Hello W

what is the use of keyword override in virtual function of child class? [duplicate]

The keyword virtual allows the derived class to override in need of polymorphism, and this can be down with or without the keyword override. H

Clarification about modern CMake structure

I am not an expert C or C++ programmer, but I have to write a C and a C++ application for two course projects. To start off on the right foot, I was reading a g

Can a constructor affect other fields of an enclosing object, or is this a static analysis false positive?

Consider this C++ code: struct SomeStruct { SomeStruct() noexcept; }; //SomeStruct::SomeStruct() noexcept {} class SomeClass { const bool b; const SomeS

Aliasing a SSBO by binding it multiple times in the same shader

Playing around with bindless rendering, I have one big static SSBO that holds my vertex data. The vertices are packed in memory as a contiguous array where each

g++ compilation won't end

I've been trying solve some problem with this code. In my machine, It compiled with no errors with g++ "File_name.cpp" but on the judges machine it uses this

How to expand particle system angle spread to 3 dimensions

I am trying to understand how to implement angle spread for a 3D particle system, to achieve an effect similar to a fountain. I can get it to work for a 2D syst

How to add two buttons to this GTK4 form?

this code show me on xubuntu 21.04 form with size (400px width + 400px height) and with ONE button. How can I add to this code two buttons? #include <gtk/gtk

C++ parallel framework to .Net (with C#) or Spring (with Java)

First question on Stack Overflow, hopefully I won't get flamed. If .Net mainly uses C#, and Spring mainly uses Java, what framework is most popular with C++ for

Is dereferencing a smart pointer async signal safe?

Let's that my C++ code has registered signal handler. According to signal-safety(7) all code called from within the handler, must use async-signal-safe function

How arrays with an empty size works in c++? [duplicate]

I'm reading some materials about C++ and I just saw that array can be declared without a size (ex. int arr[], char x[][10]) and I'm wondering

Letters not rendering with stb_truetype

I'm working on an OpenGL project and I'm using stb_truetype to render text in my game. The first font I tried (which was a .ttf file which had an OpenType forma

Enablin vsync in qt

I'm making an application in c++ and Qt. I'd like to know if the settings below are enough to have vsync enabled automatically by Windows for qt application. ev

How do you set compile flags in CMake?

I'm writing a project using the Slate linear algebra library in C++, with MKL, MPI and OpenMP as dependencies. Usually, I run my program on a Linux based system

C++ : How to create a copy constructor of array that has a pointer?

I have template <class T> class arrList: public linearList<T> { public: arrList() {} arrList(const arrList<T>& List); ~

Non contiguous array pointer traversing issue in pybind11?

Please does anyone have any idea why when I pass my 2 dim Numpy float64 (Double) array normally it prints row by row correctly, col1, col2, col3, col4 as I trav

using #if to run a function

I'm trying to run the expression _setmode only if I'm using Windows, and setlocale only if I'm using Linux, but I can't manage to make them work with a simple i