Questions tagged [c++]

C++ is a general-purpose programming language. It was originally designed as an extension to C and has a similar syntax, but it is now a completely different language. Use this tag for questions about code (to be) compiled with a C++ compiler. Use a version-specific tag for questions related to a specific standard revision [C++11], [C++14], [C++17], [C++20] or [C++23], etc.

0 votes
0 answers
20 views

How do I pass and modify an optional argument to a function through a header file in C++?

I am trying to create a function with an optional argument, where the optional argument gets modified/initialized in the function. This is part of a much larger program so I am using a header file. I ...
user avatar
  • 37
2 votes
0 answers
16 views

How does a shared_ptr handle copy to a pure virtual base class?

Class B expects to receive an instance of shared_ptr<IError>. Class A implements IError and is passed by value to the constructor of B. I would like to understand how this scenario is handled. ...
user avatar
  • 1,365
0 votes
0 answers
10 views

OPEN CV Assertion failed (img.depth() <= CV_8S && img.channels() == 1) in maskBoundingRect

my task is to get a clean image without a white background. For example, there is an image sized 50x50 but it is inside an image sized 1000x1000. To solve this problem, I decided to find the Rect of ...
user avatar
0 votes
0 answers
10 views

Visual Studio remote gcc compilation with dynamic libraries

I am successfully compiling a unix dynamic library, say myLib.so using the Visual Studio remote gcc compilation. myLib.so depends on external libraries, say libext1.so and libext2.so. I am able to ...
user avatar
  • 1,547
-1 votes
2 answers
37 views

Simple C++ code returns different outputs on different compilers

I wrote a program in C++ that receives 2 strings as input and checks if one is the inverse of the other. #include<iostream> #include<string> int main() { std::string word, ...
user avatar
  • 3
0 votes
0 answers
4 views

How to use double buffering in gdi+?

I want to get into overlays. I created a basic line and rectangle that follow a player in CSGO: void DrawLine(HWND hwnd, Vec3 screenPos, Vec3 screenHead, float screenX, float screenY, float width, ...
user avatar
  • 1
-1 votes
0 answers
16 views

C++ Input While The Text Is Updating In Command Prompt [duplicate]

I'm Kinda New To C++ And I'm Making A Game But I Need To Input Text While Some Other Text Changes Because Values Change (sorry, I know - I have very inefficient code) I Tried GetKeyState And It Just ...
user avatar
0 votes
0 answers
15 views

Export as 32-bit with CMake & C++ won't work

I have been trying to make a program for Windows with C++. I imported some libraries and wrote the code. Now this is the config for CMakeLists.txt cmake_minimum_required(VERSION 3.10) set(...
user avatar
  • 11
0 votes
0 answers
13 views

Visual studio does not see iostream, iomanip

I downloaded 'visual studio code' on a Macbook air (M2) and after running the program in C ++, visual studio gives an error 'iostream' file not found, 'iomanip' file not found. I think he does not see ...
user avatar
0 votes
0 answers
13 views

Not getting desired refresh rate when using SetPresentDuration method

I want to set a custom refresh rate in my DX application for that I have used SetPresentDuration() method of IDXGISwapChainMedia interface, the method is returning S_OK but when I am checking the ...
user avatar
0 votes
0 answers
20 views

Air control for mouse movement to change direction mid-air after jumping

I'm working on a custom character in Unreal Engine 5. I want the player to have his velocity in the direction he is looking when he is in the air (e.g. Half-Life, Counter-Strike, etc.). I already ...
user avatar
-1 votes
0 answers
25 views

When Class members and functions are stored in memory? [duplicate]

I just want to know when the data members and functions are stored in memory. I heard that the data members and member functions of a class is get allocated when a object of the class is created. Is ...
user avatar
0 votes
0 answers
19 views

List-initialization to Fixed-Sized C-Array zeroes unused indices [duplicate]

I have a constructor that looks like A (const int(&inArr)[4]) { ... } And I can construct an instance with list-initialization as such, A a({3,4,5,6}); However, I can also construct an ...
user avatar
1 vote
1 answer
12 views

deducing variadic inheritance type from constructor

I have a struct that can have a variadic number of members by inheriting from them: struct A{ int a; }; struct B{ float b; }; struct C{ const char* c; }; template<typename ... Ts> struct ...
user avatar
  • 5,729
0 votes
0 answers
15 views

Unreal engine 5 set world rotation

I'm currently trying to replicate a very simple tutorial for setting up a 2D platformer in unreal engine 5. I want to replicate the blueprint way in c++. However, I'm not able to set the absolute ...
user avatar

15 30 50 per page
1
2 3 4 5
51600