Category "c++"

How are openCV matrices serialized in Google's mediapipe

Google's mediapipe framework is able to work with openCV matrices across different languages, certainly C++ and Python. Since it uses protocol buffers to commun

What's the right cmake command to cross-compile for Raspberry Pi from M1 Mac?

My title seems general but I need to compile a project for my Raspberry Pi 3b. I want to use Telegram's Bot API server on it, but it takes a lot of time to comp

How to load the MNIST dataset from the datasets in torch C++

I'm new to torch and c++ i want to create a basic simple network that does hand digit recognition this is my Net struct. struct Net:torch::nn::Module { Net(

Getting "json.hpp: No such file or directory" error despite having json.hpp in the same folder as main.cpp

I'm trying to integrate the json c++ library from nlohmann, while simply copying the 'single_include' file to the same directory as my main.cpp file. As per the

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