Questions tagged [c++]
C++ is a general-purpose programming language. Use this tag for questions about/utilizing C++. Do not also tag questions with [c] unless you have a good reason. C and C++ are different languages. Use a versioned tag such as [c++11], [c++20] etc. for questions specific to a standard revision.
122
questions
0
votes
0
answers
27
views
IntelliSense reports that identifier "size_t" is undefined for standards > C++03
I use VS Code with Microsoft's C/C++ extension, which includes IntelliSense. Whenever I use size_t, it is not recognized by IntelliSense. I am aware that it isn’t a requirement in the C++ standard ...
-1
votes
0
answers
15
views
What language would you reccommend for building a UI to access and manipulate large SQL databases? (Why? Benefits/Drawbacks?)) [closed]
I'm fairly new to coding and have been learning and building a personal archival database using SQL over the past few months. However, I would also like to develop a simple (at first) UI to use for ...
1
vote
1
answer
28
views
Why are types escaping namespace when included after vector header?
If I compile this minimized example with clang++:
#include <system_error>
#include <vector>
namespace MyNamespace {
namespace ffi {
#include <sys/types.h>
}
void example() {
...
-4
votes
0
answers
25
views
std::vector::erase() is not erasing windows and only erasing last element [closed]
This is the broken output
void WindowManager::checkWindowsForCloseRequest()
{
for (auto window = windowStack.begin(); window != windowStack.end();)
{
if (window->shouldWindowClose())...
0
votes
1
answer
21
views
Boost Beast Websocket verify client certificate more than once on connection
I have a Boost Beast asio based websocket server, which (in abbreviated form) starts like this
ssl_context_.set_options(
boost::asio::ssl::context::default_workarounds |
boost::asio::ssl::...
0
votes
1
answer
36
views
Initializing a vector with a class that has a pass-by-reference constructor parameter and saves that reference as a member
I'm trying intending to create a single instance of a type that gets shared among the items in a vector. Each of the vector's item types requires a pass-by-reference parameter in the constructor but I ...
0
votes
0
answers
25
views
How can I use VSCode with CMake and have different targets each with a different architecture and toolchain?
I'm working on a project with Visual Studio Code and CMake where I'm compiling / cross-compiling different targets for different platforms. Currently the project has three platforms, each of which ...
0
votes
0
answers
15
views
How to Determine if a Point is Occluded by a Mesh in Vulkan Without Ray Tracing? [closed]
I'm working on a Vulkan application where I need to determine if a specific 3D point is occluded by any of several triangular meshes. The meshes are defined using vertex and index buffers. I'm ...
0
votes
0
answers
20
views
How can I get the values from Shell Property 'System.ItemAuthors' as a string array in C#?
I’m at a complete loss on how to do this. I’ll preface by saying I’m able to get many shell properties for a file when they are of type uint64, uint32, DateTime, string, etc. as the example code shows....
0
votes
1
answer
40
views
Class member function returning another class: works for getting a class variable, but not for setting a class variable
Somewhere there seems to be an implied const that is not allowing getSubsiaryClass() when changing a variable member of the SubsidiaryClass, but it works fine for reading a variable. It isn't a ...
1
vote
0
answers
25
views
C++ Image color reduction error diffusion not working
I'm trying to implement the Floyd-Steinberg error diffusion algorithm as seen on this blog and plenty of other sources and I cannot figure out what's gone wrong with my code for the life of me.
The ...
3
votes
0
answers
46
views
Why are non-type template parameters limited to structural types?
When using non-type template parameters, the non-type parameter must be 'structural' per the C++ standard. Classes with private data members are not structural. However, sometimes it is convenient to ...
0
votes
0
answers
24
views
DLL Injection Hook Not Working in WPF Application
i am student studying reverse engineering.
These days, I am learning API Hook using DLL Injector
I made personal DLL Injector using C# WPF and C++/CLI
also i have created a DLL that hooks the send ...
2
votes
0
answers
39
views
Inaccurate compile-time computation of Fibonacci sequence in a recursive lambda
Below is a recursive lambda expression that can compute the values of Fibonacci sequence both in runtime and during constant evaluation:
auto fib = [](this auto && f, auto && p) {
...
-5
votes
0
answers
34
views
How can instancing make this so much slower? [closed]
I'm drawing many copies of the same model. I can draw them by pushing a different uniform matrix for each one, or I can push a buffer full of matrices once and draw them with instancing. Why would the ...
0
votes
2
answers
66
views
Does a deque maintain its capacity even if emptied completely?
I wanted to test if a deque<> does free its chunks if it is completely emptied:
#include <iostream>
#include <deque>
using namespace std;
uint64_t nAllocs = 0, nFrees = 0;
void *...
-3
votes
0
answers
75
views
How do I get rid of this blue directory text that crams into everything else? Did I install C++ wrong, I installed MSYS2 aswell
The simple code that I ran:
I tried running, debugging, rewriting the code. I thought it would eventually fix itself, but it keeps spewing this out.
When I try it in a Command Prompt, it works as I ...
0
votes
0
answers
21
views
Giving application window active focus when opening a file
In the documentation for QWidget::activateWindow() function, the following is said:
... On Windows, if you are calling this when the application is not
currently the active one then it will not make ...
-2
votes
0
answers
37
views
Command exited with non-zero status 124
Given two integers n and x, find the number of triplets (a,b,c) of positive integers such that ab+ac+bc ≤ n and a+b+c ≤ x.
a,b,c are greater than 1. (c is k in my program):
#include <iostream>
...
0
votes
1
answer
71
views
Synchronize three Threads in C++ one after the other
This is in continuation to this really nice one: https://stackoverflow.com/a/33500554/22598822. That post was for the sequence (t1 & t2) --> t3. Let's say I have a program running, and there ...
2
votes
1
answer
75
views
explicit deleted constructors - does this matter?
When marking a constructor as deleted, i.e.
class MyClass {
// ...
MyClass(int x) = delete;
// ...
};
is there any effect to marking the deleted constructor as explicit? i.e.
...
-2
votes
0
answers
49
views
What does "+ +" (with space between + operators) do in C++? [duplicate]
The following code:
float a = 1.5;
float b = a + + 1.2;
compiles and actually returns 2.7 for b. Why does it compile, shouldn't the extraneous + be flagged as a syntax error?
It compiles on several ...
-2
votes
0
answers
20
views
How do I create CRUD in C++ and connect it to a database. A sample code or link to specific Youtube tutorial will be helpful. Thank you [closed]
I do not how to Create, Read, Update, and Delete database in C++
I tried to install mysql on my computer and I cannot connect it.
My laptop's operating system is windows. I am finding it difficult to ...
-13
votes
0
answers
66
views
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff8ed191184, pid=51412, tid=0x0000000000009a34 [closed]
I am writing protection for the maincraft cheat in the form of a native and when I added lazy importer I started having such errors
# A fatal error has been detected by the Java Runtime Environment:
#
...
-2
votes
0
answers
18
views
Qt6 QSGTexture not shown inside QQuickItem using custom shader classes
I try to show a simple texture through opengl and Qt6 using custom shader classes.
I created a QQuickItem which uses the updatePaintNode override to apply the QSGTexture to the custom Shader.
When I ...
-10
votes
0
answers
59
views
Chinese character turns into �� or @@ or just nothing [closed]
For example:
In run and debug:
In terminal:
When I input any Chinese, the debugging interface will show that the value of str1 is �� or @@ or just nothing, and it's a little unstable (but � is ...
1
vote
0
answers
33
views
How do I create a User Customizable popup menu from an existing CMenu?
I use MFCs CMenu to create right-click popup menus for many user commands (C++ using VS 2022). Is there already a framework for allowing user customization of these popup menus? Meaning the user will ...
-1
votes
1
answer
28
views
getting "expression list treated as compound expression in functional cast" CE, but everything looks just fine
I tried building this:
whole code (unordered_map.h): https://pastebin.com/u9aMaqRp
test: https://pastebin.com/KqrKwNt0
and got a CE out of nowhere...?
getting a strange compilation error while ...
-2
votes
0
answers
55
views
my code is showing wrong output in VS Code what should I do?
My code is showing wrong output in VS Code of my system whereas in online compiler and VS Code of other system it is working correctly how can i fix this issue.
Here is the code below
#include <...
0
votes
0
answers
9
views
Create nvblox depth image from sensor message pointcloud2
I have a rosbag2 with sensor_msgs/msg/PointCloud2 messages.
I am using Nvblox.
First I would like to ask if there is any way to create a depth image from the point cloud data.
Second I would like to ...
-7
votes
0
answers
75
views
Update: convert Delphi code to C++ in 2025 [closed]
I know this question has already been asked : old discussion on SO about 15 years ago. What would be the answer today in the presence of many LLM options like ChatGPT, Copilot etc...
Can they ...
0
votes
0
answers
10
views
Using GDALWarp to combine and crop HGT files
I'm trying to take a bounding box, and crop only that section from whatever source amount of HGT files are needed. I see it should be possible from this. Using GDALWarp with the following results in ...
-3
votes
0
answers
21
views
Getting values from xml string with pugi [closed]
I have the following xml :
<Ingredients attribute="true">
<Banana id="23" val="1" />
<Flour val="0.96" />
<Apple id="...
1
vote
1
answer
54
views
Coroutine awaited in parameter list breaks another parameter?
I've got the following code
https://godbolt.org/z/nehcPdxGe
#include <boost/asio.hpp>
#include <boost/asio/awaitable.hpp>
#include <boost/asio/co_spawn.hpp>
#include <gtest/gtest....
3
votes
1
answer
116
views
std::variant::operator< unexpected call to implicit bool conversion. Varies between standards
I'm seeing some unexpected behavior when using the std::variant::operator<. In the situation where the type has an implicit bool conversion operator and its less operator is not a member function (...
0
votes
1
answer
55
views
Problem with Cmake and including third-party library
I'm trying to properly configure Cmake for my CUDA project. I'm using third party library, CGBN: https://github.com/NVlabs/CGBN/tree/master and Catch2 for unit-tests.
Basically I am trying to build ...
-2
votes
0
answers
26
views
Glew installation troubles in Visual Studio 2022
I have installed opengl through nuget: Install-Package nupengl.core.
My include section now:
#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>
#...
0
votes
0
answers
38
views
Long path aware manifest opt in on older versions of Windows
I have a c++ program for which i created manifest file and set long path aware to true. On newer versions of windows it works as expected.
But what will happen if i launch my app on older versions of ...
0
votes
1
answer
66
views
c++ static_cast to virtual base in runtime
Suppose we have such code:
struct Granny {
int g;
};
struct Mom : virtual Granny {
int m;
};
struct Son : Mom {
int s;
};
int main() {
int x;
std::cin >> x;
Mom* mom = (x ? new Son :...
0
votes
0
answers
44
views
How to load a python module installed in the executable folder? (C++)
I have an install structure like this:
install_folder\
app.exe
lib.dll
python\
kitsu.py
And I am trying to execute some functions in my application from the file kitsu.py.
My C++ code is like this:
...
2
votes
0
answers
35
views
How to Optimize Cache Line Read Access with Minimal Writer Cache Impact on x86?
I'm working with an x86 processor and need to read data that resides in another processor's cache line. I am coding in C++. The data is initially in an Exclusive (E) or Modified (M) state in the owner’...
0
votes
0
answers
21
views
Unable to get correct result using cv::calibrateHandEye
I have a camera mounted on a gimbal, and I need to find the rvec & tvec between the camera and the gimbal platform. So I did some research and this is my step:
Fixed the chessboard in one place, ...
0
votes
1
answer
44
views
I want to enter a character into any index of a 2D array that has been printed onto the terminal from the terminal
I am fairly new to programming, and after a bunch of tutorials I decided to build my own tictactoe game.
After making the board and printing it in a table form, what I am trying to do now is to be ...
0
votes
0
answers
38
views
Is MockObject necessary - GTest segmentation fault
Google test with fixture's got segmentation fault
Inextricably I find segmentation fault every time compiling Google unit test.
In explanation I compile Google test without problem for test without ...
0
votes
0
answers
43
views
Error using Eigen: "mismatched types" with scalar vector multiplication [duplicate]
I am trying to perform the following operation from MATLAB using Eigen matrices in C++.
Given an example in MATLAB:
clearvars; clc; close all;
Nx = 8;
Ny = 8;
Lx=2*pi;
dx = Lx/Nx;
Vec = fftshift(-Nx/...
0
votes
0
answers
70
views
How to determine the actual (not theoretical) maximal size of vector in C++ [duplicate]
Is there a way to determine the actual maximal vector size possible at run time (in C++), other than trying vec.resize(size) for different sizes by trail and error? (vec.max_size() provides only the ...
0
votes
0
answers
47
views
Trouble with overloaded operator<< function in circular list
I am working on a program that reads in a polynomial as input, outputs the polynomial, evaluating the polynomial, and adding two polynomials while maintaining a circularly linked list. An analysis ...
0
votes
0
answers
46
views
Why does process.communicate cause my program to be killed?
I'm running some code for a program in python, and when I run c++ I need to handle standard input for my it, such as scanf and cin. I am running the compiled c++ program using subprocess.Popen. I ...
0
votes
0
answers
17
views
absl::Log Initialization in DLL Fails When Called Using ctypes on Windows
I am developing a dynamic library using C++ and utilizing ctypes in Python to call functions from this library. When I try to initialize absl::Log within the DLL, I encounter the following error:
...
0
votes
0
answers
13
views
Is there a way or solution to cancel the wait for other hpx::future get function, when using HPX?
There are many parallel tasks in my projects. I use hpx::future(usually declared in std::vectorhpx::futrue) to get task result for every one. Each task takes a different amount of time. When a task is ...