Questions tagged [c++]

C Plus Plus (C++) is a versatile coding language widely used for various programming purposes. Seek assistance with C++ related queries by tagging your questions accordingly. However, it is unnecessary to tag questions simultaneously with [c] unless there is a valid justification. It's imperative to differentiate between the languages C and C++, as they possess distinct characteristics. To address questions pertaining to specific standard revisions, employ versioned tags such as [c++11], [c++20], etc.

Issue encountered when storing and retrieving a pointer within a class using Boost.Python: incorrect data type detected

I am encountering an issue while using Boost.Python 1.54 on Windows with MSVC2010. I am trying to store a pointer to one class in another class from Python and then retrieve it, but it appears that the data type is getting altered somehow. Below are my cl ...

changing a class to JSON format with nlohmann library in C++

Attempting to convert my class to json in visual studio 2017 is resulting in linker errors C2440. Severity Code Description Project File Line Suppression State Error C2440 'initializing': cannot convert from 'ns::person' to 'nlohmann::basi ...

Can a software be created to capture search results from the internet?

Is it feasible to create a program that can extract online search results? I am specifically interested in retrieving data from Some of the data I need include application numbers, such as 9078871 and 10595401 Although there are CAPTCHAs present, I am w ...

Can anyone provide guidance on how to properly decode pusher.com's "serialized" JSON data into a QJsonDocument in Qt5?

Having trouble parsing JSON data received from a pusher.com WebSocket in my qt5 application. After identifying the issue, I'm unsure of how to resolve it: To illustrate, I created a small test program: QString str1 = "{"event":"message","data":"{ ...

How can I send form data using libcurl in C++ for a particular form?

How can I post and submit form data using libcurl and C++ for the form below? <form id="loginContainer" class="controllerContainer" action="/j_spring_security_check" method="post"> <h2>Login</h2> <hr> <fieldset> <div ...

The concept of overloading operators in V8

Here's a question that I've been pondering, but couldn't seem to find any answers for on Google. While it may not be achievable in pure JavaScript, let's say I'm developing a container class in V8 and then returning that class bac ...

Developing ES6 modules in C++ using Node.js

Here is a previous example showcasing how to create a Node.js addon in C++: https://nodejs.org/api/addons.html You can use node-gyp to build it into a common JS module, which works well with the 'require' function. However, when trying to import the com ...

Sending connected functions an object from Qt's cpp interface is currently not possible

I am trying to retrieve a JSON file from a URL and store it in a QtNetworkReply *reply. I then want to send the reply to a connected function where I can convert it into a QbyteArray to parse my JSON response. However, when I enter my connected function, ...

"Developing interoperable applications with Node.js and C++ shared

Scenario: My NodeJS server is equipped with multiple C++ modules, working together to carry out a unified task. There are certain shared objects (referred to as "singletons" in C++) within these modules whose states post-initialization need to be synchron ...

What steps should I follow to upgrade a Node.js native addon and integrate the latest API changes?

Looking for guidance on updating an old Node.js native addon that no longer works with Node.js 12 and above due to deprecated native APIs. I've fixed most errors, but one issue remains regarding initializing and calling a callback function. The new API req ...

Encountering the error "undefined symbol: speech_config_from_subscription" when using the Microsoft Speech SDK in a Node.js/C++ addon on an Ubuntu 18.4 server

My goal is to transcribe speech using the MULAW (g711) audio format with the microsoft-speech-sdk in Nodejs. However, I encountered an issue as the MULAW streaming audio format is not supported by the microsoft-speech-sdk in Nodejs. To resolve this, I am ...

Display the QWebEngineView page only after the completion of a JavaScript script

I am currently in the process of developing a C++ Qt application that includes a web view functionality. My goal is to display a webpage (which I do not have control over and cannot modify) to the user only after running some JavaScript code on it. Despit ...

When using Eclipse, each workspace must have a unique project name in order to save properly

Hey there! I've done some research on this topic already. It seems that in Eclipse, if you utilize different workspaces, you should be able to save projects with the same name. However, I am encountering difficulties in doing so and I'm not sure ...

Is it possible to use Visual Studio mixed mode debugging with a Jupyter notebook to conduct simultaneous debugging of C++ and Python code?

I am currently running a Jupyter notebook with Python that includes my own C++ extensions. Is it possible to use the Visual Studio debugger to simultaneously debug both Python and C++ code? Both projects are included in my solution and I have had success ...

A step-by-step guide to retrieving a document from a MongoDB GridFS collection

When it comes to connecting with mongodb, my approach looks like this: routes.js: "use strict" const Router = require("koa-router") const bind = require("koa-clean") const FsFilesController = require ("./controllers/ ...

Error encountered during Raspberry Pi build with OpenCV

While attempting to build opencv-3.2.0 on a Raspberry Pi using cmake, I encountered an unusual error during the installation process when it was 99% complete. I didn't make any changes to avoid causing any problems, but it appears to be a simple codi ...

Unable to compile a virtual file within a PHP extension

I have been developing a custom PHP extension and made modifications to the zend_compile_file function. Here is the source code snippet: FILE *bravery_ext_fopen(FILE *fp) { struct stat stat_buf; char *datap, *newdatap; int datalen, newdatalen; char ...

Leveraging the firebreath plugin to trigger a folder dialog, enabling asynchronous selection of folders to preserve the smooth execution of Java Script without any blocking

I need to ensure that only one folder selection dialog is open at any given time. Once the user picks a folder, an event will be triggered to notify the JavaScript of the selected folder. In order to open the dialog, I have integrated code from this gist ...

C++ techniques for optimizing set operations: union and intersection

When given two sets, set1 and set2, I am tasked with calculating the ratio of their intersection to their union. Currently, this is the code I have: double calculateRatio(const std::set<std::string>& set1, const std::set<std::string>& ...

Is it worth developing a QT C++ class specifically designed for storing parsed information from JSON text?

Question Summary Is it advisable to develop a class for storing information parsed from JSON text with QT C++? Are there better alternatives? NOTE! I'm limited to posting only two links due to being new, but if more information is needed to answer the q ...

Is there an excess memory consumption associated with objects encapsulated by pybind11?

I'm curious about the potential memory implications of using C++ classes or structs wrapped by pybind11. Let's explore a simple scenario: struct Person { std::string name; int age; } // Demonstrating basic bindings pybind11::class_<Perso ...

Modify property page configurations in Visual Studio C 2010 Express

A while ago, I made some adjustments to the Property Pages and Configuration Properties, such as the output directory and code generation settings. Now I want to revert back to the default settings. Despite trying to reset all environment settings using th ...

Improper transformation of raw RGB depth image into grayscale

Working with a Python simulation that includes a depth sensor and C++ visualization has been quite challenging for me. The sensor provides an image that needs to be converted to grayscale. https://i.stack.imgur.com/Dmoqm.png To achieve the conversion, I ...

Ideal C++ tool for displaying a non-changing HTML page

I am looking to develop a simple cross-platform C++ project for displaying HTML pages, like an application that showcases help materials. These pages may contain images and styles (CSS embedded in HTML). I am researching the best way to incorporate the fol ...

Having trouble troubleshooting C++ code in Visual Studio Code

Recently, I downloaded Visual Studio Code v1.7.1 to work on my c++ coding assignments for my degree program. While my programming skills are at a basic level, I am quite impressed with VS Code, except for one thing - I have no clue how to debug or build my ...

In C++, JSON only permits a single top-level item

It seems that my object creation code is not working properly, despite referring to numerous examples. I am combining the "Staff" label with Staff ID for easy reference later on. The contents of the json object depend on user input. I am utilizing the nlo ...

The self-registration of the module was unsuccessful. A custom build C++ node module compiled with cmake-js was utilized within the Electron app

Currently working on a project where I created a C++ module for Node and compiled it with CMake. However, when I tried to use this module in my main Electron app, it resulted in errors. To demonstrate the issue, I have created a minimal repository here: h ...

HTML forms are larger in size on web pages than in Internet Explorer

https://i.stack.imgur.com/bUPtm.png I have posted the issue, and it is predominantly visual in nature. When viewed on a web browser within a C++ interface, the HTML appears significantly distorted. ...

Which programming languages are recommended for building a web crawler?

My background includes extensive experience with PHP, but I have come to understand that PHP may not be the most suitable language for building a large-scale web crawler due to its limitations on running processes indefinitely. Can anyone recommend alter ...

Saving data into JSON file was unsuccessful due to incorrect ordering of the entries

Currently, I am developing a desktop application using QT C++ that is responsible for converting a text file into a JSON file. Here is an example of the desired output: { "102": { "NEUTRAL": { "blend": ...

Utilize the rapidjson library to convert a JSON array containing a mix of numbers into integer, unsigned integer, and float

From my understanding, this char* represents a valid json-string. const char* jsonData = { "array":[14, -15, 3.17], "array_type": ["uint", "int", "float"] } The requirement is for all numbers in the array to be of 4 bytes length. The question is how one ...

Utilizing JSON and forms within Visual Studio environment for seamless development

When I work on Visual Studio and create a form, the common language RunTime Support automatically changes to /clr. However, when I try to add json libraries, I encounter the following error: is not supported when compiling with /clr or /clr:pure Switc ...

Deciphering the JSON array generated by PHP

When PHP returns a JSON array, the output may look like this: [ { "uid": "1", "username": "mike", "time_created": "2014-12-27 15:30:03", "time_updated": "2014-12-27 15:30:03", "time_expires": "2014-12-27 15:30:03" }, { "uid": ...

Invoking a C++ dll in the renderer process of a Node.js application with Electron using node ffi

As I work on developing a windows application using electron, my goal is to utilize the ffi-napi to invoke C++ .dll methods. However, I am facing a challenge with the "Passing_Dll.js" file, where the label with id "GenName" is not being updated when clicki ...

The subprocess becomes unresponsive when reading from popen().stdout

I've been struggling with a problem that has been bothering me for quite some time now without finding a solution. I have been using subprocess.Popen() in Python to access a C++ application that performs heavy calculations for me, but it keeps freezing on ...

Converting std::list to JSON using Boost Property Tree

After struggling with this problem for the past few days, I am still unable to figure it out. I have a std::list container that I need to serialize into a JSON string in order to send it over the network. NOTE: This is how I compile my code: g++ -std=c++ ...

Steps for creating a QJsonObject using a QString

As a newcomer to Qt, I am looking to perform a very simple operation: I need to acquire the following JSonObject: { "Record1" : "830957 ", "Properties" : [{ "Corporate ID" : "3859043 ", "Name" : "John Doe ", ...

Python os.system() function yielding incorrect result

In my current project, I am utilizing a Python script that utilizes the os.system() function to repeatedly call a command line program for running test cases. The program in question returns zero for typical operation and a negative value for error situati ...

Pass a PHP string to C++

I have a question about passing a string from PHP to C++. I've been able to pass numbers successfully, but I'm running into issues with passing letters. Here's the PHP code that works: <?php $r = 5; $s = 12; $x = 3; $y = 4; $q = "Hello World"; $c_o ...

How can the callback from C++ be successfully installed in the Javaobject window within QtWebkit?

I have successfully implemented HTML-JS to call a C++ method using QtWebkit. Now, I want to send a callback from the C++ method to the JavaScript window. How can I achieve this? Below is my code snippet. #include <QtGui/QApplication> #include <Q ...

Executing a callback in Javascript from within a NAN AsyncWorker in a NodeJS Addon

Exploring the idea of calling a Node.js callback from within my asynchronous addon function has been an interesting journey. I found inspiration in both synchronous (here) and asynchronous (here) examples to guide me. However, encountering a Segmentation ...

Guidelines for embedding a JSON file or object within C++ during compilation

I have a JSON file named env-config.json containing database environment configuration data structured like this: { "LATEST":{ "DB_DATABASE":"databasename", "DB_HOST":"hosturl", "DB_PORT":"3306", "DB_USER":"root", "POOL_MAX":1 }, "PROD":{ "DB_DATABASE":"d ...

The request in C++ is failing to reach the intended computer

Trying to utilize libcurl with C++ for sending an HTTP request to a remote host (my friend's computer) over the internet. On the receiving end, Node.js script is used to handle this request. I have successfully tested this code (both C++ and Node.js) ...

Transferring binary information from C++ to Node.js

I have a binary data stored in a C++ variable called buffer. Here is the code snippet: int len = 39767; uint16_t * buffer = (uint16_t) malloc(len); FILE * fp = fopen("rahul.jpg", "rb"); // file size is 39767 bytes. fread(buffer, len, 1, fp); fclose(fp); f ...

Tips for incorporating a multimedia HTML/JavaScript application within C++ programming

I possess the source code for a JavaScript/HTML5 application that operates on the client-side and manages the transmission/reception of audio and video data streams to/from a server. My objective is to develop a C++ application that fully integrates the c ...

Having trouble with sending a typed array to a subprocess's stdin

I've encountered an issue where sending data from a typed array to a subprocess's stdin gets truncated if the data in the typed array is changed. Below is a small example demonstrating this problem. The subprocess in question is a simple C++ app ...

Parsing and transforming Cyrillic Unicode characters from a JSON file using C++

I have a JSON file containing the following data (as an example): { "excel_filepath": "excel_file.xlsx", "line_length": 5.0, "record_frequency": 2.5, "report_file_name": "\u041f&bs ...

error encountered while parsing nlohmann json at memory location

Currently working on a C++ program that aims to fetch information from multiple pages of an API endpoint and store it in an array. Utilizing cpr as the requests library for fetching pages accurately, followed by nlohmann's json library for parsing and ...

Comparing TypeScript and C++ in terms of defining class reference member variables

class B; class A { A(B b_) : b{b_} {} B &b; }; In C++, it is possible to have a reference member variable like 'b' in class A. Can the same be achieved in TypeScript? Alternatively, is there a specific method to accomplish this in ...

Is it possible to render a web page in C++ that includes JavaScript, dynamic html, and retrieve the generated DOM string?

Is there a way to fetch and extract the rendered DOM of a web page using C++? I'm not just talking about the basic HTTP response, but the actual DOM structure that is generated after JavaScript has executed (possibly after allowing it some time to run). Ar ...

Error message "File or directory does not exist" encountered in Qt Creator

Currently, I am using Qtcreator to create forms and want to execute a Python script when a button is clicked on my form. However, when I try to include the Python header file: #include <Python.h> I encounter the following error message: python.h: ...

Creating a shared library in VS2015 results in the error message: "The client is not compatible with the corresponding build agent."

I set up a shared library using Visual Studio Enterprise 2015 Update 1 : File > New Project > Templates > Visual C++ > Cross Platform > Shared Library (Android, iOS) The default project structure was generated as follows: While the android ...

Retrieve an array of wide characters leading to a memory leak

I need help creating a JSON string from my input arrays. I used "new" to allocate memory for the JSON, but I'm unsure about how or where to deallocate this memory. Is there a more efficient way to write this function? wchar_t* SetExpectedTabsDat ...

Discovering the data types of various dictionary values within a JSON file can become a bit tricky when dealing with null values

I am working with a large set of dictionaries from a JSON file, each containing the same keys but different values that can be of multiple types, including null. I need to determine the type of each value so that I can initialize the appropriate variables ...

What is the reason behind the limitations in the C++ node API for Electron that prevent the initialization of array buffers with external data?

Recently, I was working on developing a NodeJs module for electron using C++ and the Node addon C++ API. My goal was to create an ArrayBuffer object that would contain the data of an image I had read using C++ iostream functions like ifstream::read(). To ...

Working with C++ to extract and store information from a map containing boost::any values in XML or JSON form

The map is declared as follows: std::map<const std::string,boost::any> data I am looking to create a function that can transfer all the data from the map to a file and another function that can read this data back in, initializing the map with the c ...

``"Issue: 'remap' function is not recognized within the 'cv' module"`` occurring during the execution of the command "python setup.py install

Currently attempting to set up a face tracking system for Python on Ubuntu using the terminal. I installed the necessary files from the following links: The setup.py version for Linux can be found here: Despite following the steps and navigating to the p ...

Exploring the Power of Boost with JSON Data

Is there a specific library in Boost that can handle JSON data while maintaining the original data types? I am aware of property_tree, but when I use it to read a valid JSON and then write it back out, all fields are converted to strings. This is because ...

Getting a zero-copy perspective from a C++ raw pointer within pybind11: A step-by-step guide

Kindly review this quick example. sample.cpp #include <pybind11/pybind11.h> #include <pybind11/operators.h> #include <pybind11/numpy.h> namespace py = pybind11; class example { public: example(float val = 1.0f) { data[0] ...

Can values be retrieved or updated from a vector<json> using a pointer?

Currently in the midst of exploring C++, my focus is on finding the most recurring values in a large array using vectors and json. To enhance efficiency, I opted to introduce threading but encountered issues with pointers and addresses. The task at hand i ...

I have some information stored in JSON format and I am looking to transform it into a CSV file

#include <bsoncxx/builder/stream/document.hpp> #include <bsoncxx/json.hpp> #include <mongocxx/client.hpp> #include <mongocxx/instance.hpp> #include <fstream> #include <iostream> #include <string> using namespace s ...

Creating a NodeJS package that automatically compiles C++/WebAssembly during installation

What is the best way to structure a NodeJS package that includes wrapped C++ code compiled into web assembly? How can we ensure that the compilation step takes place when using npm install <package name>? I have developed a package called mypackage ...

Experiencing the error message "json.hpp: No such file or directory" even though the json.hpp file is present in the same directory as the main.cpp file

Currently facing an issue while trying to incorporate the json c++ library from nlohmann. I have copied the 'single_include' file to the same directory as my main.cpp file, following the recommended integration guidelines. The essential file is json.hpp l ...

Error: The specified JSON path for Ajax request could not be

Although my expertise lies in C++, I must confess that my knowledge about web development is quite limited. Therefore, please bear in mind that my question requires a simple answer. Recently, I stumbled upon a fascinating C++ library for creating a web se ...

How can I retrieve the position of a node in rapidjson?

I'm using rapidjson to deserialize a JSON string into an object. However, when there are issues with the content rather than the structure of the JSON, I want to be able to report an error indicating the offset where the problem occurs. The challenge ...

universal live media streaming application

I am currently developing a client-server solution with the following behavior: - The server side (C++) sends frames in a standard format. - The client side (C++) receives, decodes, and displays these frames. My goal is to integrate this solution into a c ...

Setting up environment variables for php-cgi

Currently, I am in the process of building a small web server using C++. My main focus right now is on adding support for POST requests specifically for PHP pages. I have encountered some challenges when it comes to passing the POST request body to the PH ...

Is there a way to merge TypeScript code with C++ during compilation?

Currently, I have a project written entirely in C++. However, there is an additional file written in typescript because I couldn't find equivalent libraries in C++. This typescript file performs the following actions: It contains a typescript CLI code gen ...

Eliminate deeply nested JSON object using rapidjson library

I have been struggling to find a solution for removing an object nested within another object in a JSON file. Despite searching extensively online and on the official rapidjson page, I haven't come across any relevant examples or resources. The code I am w ...

What is the method to initiate a Python thread from C++?

In my current project, I am specifically limited to using Python 2.6. The software involves a Python 2.6 application that interfaces with a C++ multi-threaded API library created with boost-python. I have been trying to implement a Python function callback ...

A peaceful WCF service initiates a client callback whenever a server update occurs

In the process of developing a WCF RESTFUL service on top of a c++ console application, I am confronted with an issue. The client accesses this c++ application through my restful wcf service using a browser. Every time there is an update received by my w ...

What is the method for connecting to USB using Electron?

My current setup: Windows 10 with Visual Studio 2015 (including C++ Compiler Tools) and node.js installed I attempted to integrate a node library into the electron-quick-start-project but encountered issues. Initially, I tried using electron-usb. You can ...

What is the best way for a background service operating within a web server to update the client browser on its progress?

As a newcomer to many things, I am open to any suggestions, input, existing projects, or models that you may have. Currently, I am facing the following challenges: The background service is responsible for managing a queue of tasks in either C++ or Py ...

Error: Unable to locate Platform Toolset = v141 during NPM installation

My attempt to set up the Barcode-Scanner-npm library has hit a roadblock with this error message showing up: C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Too ...

What steps are needed to resolve an "undeclared identifier" error when using a NanAsyncWorker parameter?

I recently came across this code snippet from a GitHub link at https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate and it sparked my curiosity. class PiWorker : public NanAsyncWorker { public: PiWorker( NanCallback *callback, NanUtf8S ...