Category "c++"

QSqlDatabase is opened but QSqlQuery does not execute and shows error database not opened

I am working on a project. I am trying to run this query but it fails and gives the error. Here is the code: QSqlQuery* printQry = new QSqlQuery(); if

Automatic differentiation using expression templates c++

Introduction I am trying to learn about expression templates because it seems to be a very powerful technique for a wide range of calculations. I looked at diff

cmake : shared library or sub-prjoect

I am builfing a new c++ project and i want to integrate cmake and i dont know what is the best approach i have to follow my project tree looks like this : .

How come the fmt library is not header-only?

I know it is possible to use the fmt formatting library in header-only mode: How to use fmt library in the header-only mode? but - why isn't it just header-only

What is differnece between CreateWindowEx, CreateWindowExA, CreateWindowExW?

I read the documentation about CreateWindowEx CreateWindowExA CreateWindowExW and they all are seem to be identical to each other. if there is not difference w

Trying to run a cpp program but I get the following error: [process exited with code 3221226356 (0xc0000374)]

I am currently trying to execute the following cpp program on Windows: #include <cstdlib> #include <iostream> #include "math.h" #include <fstream

Drawing with cv::circle's over a line Iterator in c++ with openCV

I'm creating an iterator line, which I pass through a for() and draw with cv::circle points. So far so good, form a line drawing, by the iterator's line points.

How to shuffle a std::vector?

I am looking for a generic, reusable way to shuffle a std::vector in C++. This is how I currently do it, but I think it's not very efficient because it needs an

Does vector know to reserve first when initializing by a pair of iterators?

Consider the following code. struct MyData{ MyData(const BYTE* pData, size_t uSize) : bucket_(pData, pData + uSize) {} std::vector&l

GetCommTimeouts function failed with error code 50

when I develop a PCIe communication interface, I used CreateFile & Readfile function to operate the device. But when I tried to set timeout to the handle, I

static_assert expression is not an integral constant expression with __builtin_clz

I have the following code: typedef unsigned char uchar; constexpr int leaing_ones(uchar const u8) noexcept { return __builtin_clz(static_cast<uchar>(~s

How to handle "java.lang.UnsatisfiedLinkError" when the library path is satisfied?

I'm trying to export a c++ library function through JNI, I've this header file called "Pylon.h" here's the source code: /* DO NOT EDIT THIS FILE - it is machine

My segment tree update function doesn't work properly

The problem: In this task, you need to write a regular segment tree for the sum. Input The first line contains two integers n and m (1≤n,m≤100000), the s

If MinGW-w64 doesn't support wWinMain, then what C++ compiler should I use instead? [duplicate]

I've been attempting to follow this guide here for writing a program in C++ that allows me to create an application window, however I ran into

'base/debug/debugging_buildflags.h' file not found when building project with webrtc

I am building a project that includes webrtc with CMake, Visual Studio 2019 and ClangCl. This is the command I run to configure : cmake -G "Visual Studio 16 20

C++ How to create a constant pointer to a function?

I want to have a class with a constant pointer to a function as a member. However, I'm instead creating functions with constant return values (a strange feature

cannot convert 'LinkedList::filter(void (*)(Node*))::<lambda(Node*)>' to 'void (*)(Node*)'

Im trying to implement a simple LinkedList class, but this error shows up and I don't understand why. struct Node { public: int val; Node* next; Nod

Compile microsoft rpc server with nmake: Error LNK2001: unresolved external symbol Output

Dear fellow programmers, Currently I am working on implementing a Microsoft RPC server / client program on Windows. Using nmake, I managed to compile the client

How can I implement parallel Cartesian Product efficiently using C++ Cuda

I have two arrays A and B which have m and n int variables respectively. I have a function f, and I want to generate all f(a, b) which a is in A and b is in B:

Qt - Add item from a second window to ListWidget in MainWindow

I have a QDialog where I can enter a Text and add it to a ListWidget inside the MainWindow after I clicked OK. Therefore I created a Method in the MainWindow cl