Category "c++"

Raycasting rendering - wall's edge crossing issue

I'm implementing a fake 3D rendering using raycasting method (such as Wolfenstein3D). I have following the permandi's tutorial (https://permadi.com/1996/05/ray-

Why is this happening with my C++ application? [closed]

I'm currently learning C++, and at the moment I'm starting off by making multiple kinds of calculators to test my problem solving capabilities

sprintf precision typecasting leading to compilation warning

I have the below C++ code which issues a compilation warning as shown below. Case 1: char temp_buffer[80]; double **data; .... sprintf(temp_buffer, "%.*g", size

Changing function in an object's member

I am trying to write a very simple game using C++ and SDL2. I have a gameObject class and a player object. I am trying to change the update function for the pla

Can auto-vectorization be automatically done by #pragma omp simd? [duplicate]

In order to use auto-vectorization for a c++ code which will be running on x86-64 and aarch64 processors, is just adding #pragma omp simd in t

Linker causing seemingly random crashes?

EDIT: After some more trying and testing, it seems to set down to changing stack size everytime I change code and I want the program to run. If I don't change t

Why concurrent using `printf()` not causing overflow?

I'm doing some experiments on printf(), my code is shown below: #include <iostream> // std::cout #include <thread> // std::thread vo

Xcode 13.2 does not build project with OpenCV - 4.5.3

I am trying to integrate OpenCV framework in my cocoapod project. The steps I have followed to integrate OpenCV Deploy OpenCV framework to the private repositor

Does header file import modules a standard thing?

C++ 20 modules guaranteed backward compatible so modules can import headers. And Visual Studio introduced header file import modules,is this stardard or just a

Can ssh accept an encrypted password?

I'm designing an app recently. For some reasons I can not use the ssh-key to connect to the remote server, so I wonder whether I could just pass an encrypted pa

How to use FFmpeg to generate a pure black stream and push to RTMP by code in C++

I'm new in FFmpeg. I want to generate a pure black stream using FFmpeg, and I don't want to use the FFmpeg command. I know below command can work. ffmpeg -f lav

Why is it not dividing correctly [closed]

Why is this code not dividing correctly? This code is supposed to find the sum of all the numbers that can mod b(from 1 to a), and the numbers

Overwrite elements in std::shared_ptr to array, what got wrong?

I have following header : #ifndef MY_TEMPLATE_CLASSES_H #define MY_TEMPLATE_CLASSES_H #pragma once #include <cstdio> #include <iostream> #include

Moving the function templates definition to different translation unit resolves the ambiguity error

I was using function templates when I noticed that moving the definition of one of the function template to a different translation unit resolves the ambiguous

How do I fix the random selection and apply a minimax algorithm for choice?

for this TIC TAC TOE game, I'm new to coding so I'm not sure how can change the A.I to play more intelligently, I know it's with the use of a minimax algorithm

co_await is not supported in coroutines of type std::experimental::generator

What magic generator should I define to make the code below work? #include <experimental/generator> std::experimental::generator<int> generateInts(

why alignas(64) not aligned with 64

why alignas(64) not aligned with 64? for example: struct alignas(32) st32 { float a; uint16_t b; uint64_t c; }; struct alignas(64) st64 { float

Seamless Loop Problem with Media Foundation

I am trying to make seamless looping video in a game engine, and I have two questions. Even though I used the Sequencer Source, I still found that the playback

I'm trying to create a 2D vector to which i can append values easily

In my head it seems like creating (a) vector by pushing n number of elements and then appending the (a) vector to the (b) vector to make a 2D vector. I'm still

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?