Category "c++"

QtCreator issues ld: warning: directory not found for vcpkg Qt

I installed Qt5 with vcpkg on macOS Catalina. And installed QtCreator using the online installer. Then on QtCreatpr, Preferences, Kits, Qt Versions I added qmak

I keep getting this error: expected primary-expression before 'int'

I am trying to solve this exercise on Exercism website. The exercise is about finding the leap year. I have two files, main one and the header file. The main on

Why does CMAKE need two build runs to compile open625251 encryption correctly?

I am somewhat new to CMAKE and need your help. I am building a project that uses the OPCUA library open62541 and after including encryption, the build process i

Build OpenCV for Android with CMake's ExternalProject_Add

I am creating an Android library that uses OpenCV via NDK. It doesn't require any Java parts of OpenCV, native parts only, so I decided not to use OpenCV for An

vector push_back memory access denied in Visual Studio

#include <stdio.h> #include <vector> using namespace std; int main() { vector<int> numbers; numbers.resize(10001); for (int i

how to handle garbage value while making my own vector in c++?

Good evening guys I am trying to make my own vector class. But I have few problems. Firstable, I dont know why There is garbage value I've tried to check constr

Meshes loaded via Assimp look distorted

So I'm trying to load and render mesh with assimp and DirectX11.(Im loosely following tutorials on youtube) The problem is that it looks weird and distorted. I'

When I run the program, I don't get any errors, but after I have already set the value of the variables, I get this error

When I run the program, I don't get any errors: #include <iostream> #include <string.h> using namespace std; int main() { string s1, s2, s3;

ARP sniffer and packet interception

i want to sniff arp replays to be more specific i want to intercept arp packet and retrieve ip addresses using libtins im not quite sure with the filter i put "

Find the K-Beauty of a Number Unexpected Runtime Error

I was recently doing the first question in the Leetcode Biweekly Competition 78, and I received an unexpected runtime error which I couldn't understand, especia

Why does interrupting a simple C++ program under Valgrind results in segmentation fault?

Consider the following program: #include <iostream> int main() { std::cout << "Hello, World!\n"; } I compile it with on Ubuntu 20.04 (Focal F

How to annotate functions to aid code analysis

Consider the following functions: constexpr bool IsNull(const int* arg) { return arg == nullptr; } void Test() { int x{ 42 }; int* p = &x; /

Why I get an error when including sdl image?

I set SDL2 and SDL_image 2 in Code::Blocks and now I get an error: "fatal error: SDL.h: No such file or directory" Can someone help, everything seems okay. My i

How to define and call functions in c++?

I am new to c++ and I am wodering how to properly define functions? Right now I am receiving the following errors: Severity Code Description Project File

How do you use std::distance in a range-based loop?

This is my code that won't compile: for( auto occurances : occ ){ if( occurances == 1 ) cout << distance( occ.begin(), occurances ) } It gave me th

C++ google test fail for multi threads

I am having following C++ code and corresponding unit tests in google test. I am studying book on Modern C++ programming using Test Driven development. Below co

How the vector gets returned even though it is a local variable inside a method of a class

The vector<int> bfs is local to the method bfs_of_graph then how can we return the vector as it would be erased in the memory and only garbage values shou

Compute shared secret for ECDSA<ECP, SHA256> keys with Crypto++

I'm trying to do the following: Receive x and y coordinates of a EC public key Generate a random EC public key Compute the shared secret of the two keys I'm stu

ASSERT: "i >= 0 && i < size()" in file Qt/6.2.4/mingw_64/include/QtCore/qstring.h

i am a noob in Qt, when a push a particular push button, the project window closes and shows this error: ASSERT: "i >= 0 && i < size()" in file Q

How to find the count of sub numbers of size k which divide the number

Given a number n Find the count of the sub numbers of size x in a number num which divides num. For example, if the number is 250 and x=2 the answer will be 2 a