Category "c++"

How to customize QModbusDataUnit to send hex values in modbus?

I would need to customize the QModbusDataUnit by sending custom hex via modbus, below my code, I'm trying to customize the post but I do not understand how to d

<command-line>:0:3: warning: ISO C++11 requires whitespace after the macro name

I am compiling qt sources (C++) on different version of Ubuntu OS (14.04 and 16.04 LTS). The sources compile (g++) on 14.04 LTS without warnings. But on 16.04 g

How to check for overflow in duration_cast

I need to convert one kind of std::chrono::duration to another kind but I need to know when such a conversion is not possible because the value would not be rep

Error in setting up goldbolt with childprocess launch failure

I got error in setting godbolt: https://godbolt.org/z/MYcqjeMKe Program returned: 255 [F][2022-02-14T15:04:35+0000][1] bool subproc::runChild(nsjconf_t*, int, i

C++: What is the correct cast for offseting to std::vector iterator?

I have a function that takes a std::vector of doubles, and copies them to another vector, but at a particular offset (assume there is sufficient space): void c

What is the best way to define the same fmt::formatter for multiple types?

I am attempting to write a custom formatter for a Vector<VType> vector. Depending on build settings, this could be a std::vector, or a __gnu_debug::vecto

How can I code something like a switch for std::variant?

I have some var = std::variant<std::monostate, a, b, c> when a, b, c is some types. How, at runtime, do I check what type var contains? In the official do

How to link shared library on linux using cmake?

How to link shared library on linux platform? I downloaded sfml library using apt cmd and I tried to run simple example: main.cpp #include <SFML/Graphics.hpp

OpenGL texture gets worse when moving camera away from object

The texture gets generally worse more I move the camera away from the object. I need to be really close to the object for the texture to be fine. Does anyone kn

how to access the elements of a dlib matrix / vector?

std::vector<matrix<float,0,1>> face_descriptors = net(faces); Above is what i was looking for.When I use the following command std:: cout >>

How can I convert C++ code of a CRC16-CCITT algorithm to Python code?

I have an example code for CRC16-CCITT algorithm written in C++ and I need help converting it to Python. Example C++ code: #include<iostream> using n

Can't get OAuth 2.0 code in Qt app, but is seems to work in browser

I'm trying to configure communication with Google OAuth 2.0 in my Qt project. I was using this tutorial, although it seems to be a bit outdated. I configured ev

Delay in Dev C++

I have come across to a problem while coding in C++ on Dev C++ compiler. I want to delay my statement to some milliseconds, but the problem is dev doesnt suppor

google mock - can I call EXPECT_CALL multiple times on same mock object?

If I call EXPECT_CALL twice on the same mock object in the same TEST_F . . . what happens? Are the expectations appended to the mock object or does the second

boost::interprocess::interprocess_condition::timed_wait() compiler error

I'm trying to create some objects in shared memory (which will be a future question) but for now I've getting a compiler error (boost 1.53.0 using g++ 4.8.5 on

QT Creator and OpenCV455: 'arm_neon.h' file not found

I'm building a project using qt6 and opencv455. I'm doing this on the new MacBook with a silicon chip (arm64). I can compile the whole project without errors, b

Delphi Kiosk mode template issue with C++ Builder (can find xml)

I could desperately use some help with finding out why Embarcadero's Android Kiosk Lock mode template is having issues deploying. I have C++ Builder 11.0 Alexa

How to read/write doubles in a binary file?

I am creating a program that will write and read the content of a binary file. The part I am struggling with is reading/writing pointsEarned and studentGPA as a

Run time error assigning cv::Mat element value using cv::Mat::at

In the following code I would like to assign a values to elements of a Mat variable in a loop. I get the runtime error below. pair<Mat, Mat> meshgrid(vect

MSVC C++ find out what function requires linker symbol

I have a special situation. In my project the kernel32.lib is replaced by a substition library (Windows realtime extension RTX). So I do not link to kernel32.li