I have been trying to complete the first tutorial on the FreeType website. I am using the provided code on the website and I have added the libraries and included the proper include files but I rec...
I am trying to generate cryptographically secure numbers in Windows. I have the following code:
#ifndef w64crypt
#define w64crypt
#include <windows.h>
#include <bcrypt.h>
unsigned long
I am trying to understand how the initialization of a pointer to a struct object (which contains a pointer to a struct of the same type) occurs. e.g I have a struct:
struct node {
node *next;
...
For a C99 code base I am heavily depending on macros as a poor man's substitute for proper C++ templates. The most severe downside of macros for my use case is that it is hard/impossible to debug the
When using the Windows IFileDialog interface to launch File browser dialog, I face an issue if the default filename provided exceeds certain number of characters.
The filename appears truncated,
In Sublime Text, if you hold control while clicking, you can add another cursor to the document, allowing you to type and edit in multiple places at once. I'm trying to recreate this with Qt's
I'm having some difficulty reproducing an example program of Object-Oriented Programming Using C++ described in "Encapsulation and Type Extensibility."
For simplicity's sake, I've cut out most of...
I'm study c++ Pointer using Notpad and Command Prompt,compiling by g++, executing the file(a.exe produce by g++). when I playing the code by delete "mypointer = &firstvalue;" The window defender po...
I want to use an iterator for a 2D array but I don't know how.
My purpose is to access the columns and not the rows.
I found out that to access the rows I can use this auto it=begin(arr); but I thi...
I'm trying to make bison more memory efficient by using std::shared_ptr. I do not want to use raw pointers. I'm using a node system as the parse tree so I define YYTYPE as std::shared_ptr<Node&g...
The goal is to be able to get the value of a widget such as FL_Input when I click my button.
One way I could do this is by using events and classes. Such as
#include <FL/Fl.H>
#include <FL/
I am using ROSCPP and writing my own Node within i want to load Worlds in Gazebo, simulate and delete it from gzserver. Then it should start again with another world file.
The Gazebo API offers the
I'm using atom to practice C++ (I'm very new). I just learned to initialize variables like the following:
#include <iostream>
using namespace std;
int main() {
int myInt {};
return ...
So, i have a cursor sprite:
I load this sprite with:
sf::Cursor cur;
sf::Image cur_default;
if(!cur_default.loadFromFile("assets/sprites/cursors/cursor_default.png"))
{
std::cerr <...
While reading some code, I didn't understand the meaning of the const modifier. For example, are the following two lines equivalent?
void output() const;
const void output();
I'm using visual studio code for MQL4 files (*.mq4 - Metatrader) and using cpp associations in my settings
"files.associations": {
"*.mqh": "cpp",
"*...
I'm a beginner at programming and would like to know more about C++. I installed Netbeans since it says it supports Java (which I am currently studying the basics at school) and C++ (which I want to
I am attempting to create a Voronoi diagram from line segments with the following code.
#include <iostream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <...
EDIT
I included a screenshot of the compile error with reworked code. compile error screenshot
ORIGINAL POST
I am writing a little program to practice my knowledge of priority_queue containers. I am
English is not good, but please understand.
string str;
string str_base = "user name = ";
string str_user_input;
string str_system_message;
...
str = str_base + str_user_input + "\n [
I am trying to access to the Time Of Flight sensor, in order to use the data. In the Huawei AR Engine documentation I found the following function :
HwArPointCloud_getData(ar_session, ar_point_clou...
I am starting a new project and it will require the creation of many C++ classes. In order to keep the project organized I created coded standards that will keep methods and member variables organi...
I've been given a 2D vector (A). I need to store values of row and column index of that vector which contains element 0.
Here is my code-
vector<pair<int,int>>v;
for(int i=0;i<A.s...
I am looking for a way to extract the types of an std::tuple to define a method signature. Take the following (contrived) example:
template <typename RetT, typename... ArgsT>
class A
{
public...
I have implemented a gRPC server application and multiple clients can connect to it and call RPCs.
In the cases of client disconnection or client restarts, I would want to know which client got
I've some C++ code that is expecting to receive one of two protobufs. (This has occurred as an accommodation to history, not as an intentional design.)
The ParseFromString function returns false i...
I am doing a algorithm and data structure exercise in C++ which requires to read a ten-word txt file then display them in a reserved order by using a stack without STL, class or struct. All the code
This code calls the posted handle
boost::asio::io_context ioc;
boost::asio::post(ioc, []{ std::cout << "lol" << std::endl; });
ioc.poll();
whereas this doesn't:
I'm tracking down a performance bottleneck. To narrow down the cause, I created a test using the SimpleTrianglePC sample from the Xbox ATG Samples repo.
I made only a few changes: I changed Draw to
Why do the following quicksort implementations have a large difference in performance? The implementation using iterators takes twice as much time as the one using indices; at both -O0 and -03
I've a rather complicated problem, but try to break it down to some basic stuff I can't get my head around.
At the end, I need to get a hash out of a user input string, which must be the same on Ma...
This error happens to me when I use the helper function from microsoft docs to migrate to winrt from cx. I see a similar question here, but the solution mentioned doesn't seem to work for me. The
Hello I am new to C++ and have been building an addon for one of my programs using node-gyp. However, when I try to build the addon I run into this error:
watercpp.obj : error LNK2001: unresolved
I'm using apache thrift in version 0.13.0.
As soon as the time between two calls is approximately 1.5 seconds the connection will be closed.
The timeout varies from 1.3 to 1.8 seconds.
keepAlive is...
In the description of the std::async it is said that:
If the std::future obtained from std::async is not moved from or bound
to a reference, the destructor of the std::future will block at the
end...
I am performing a simple masking operation with a 5x5 window. Following the accepted solution from this post Problem with Operation on Border pixels of an image (second solution), I have created a ...
Consider this simple check for whether a (global) function is defined:
template <typename T>
concept has_f = requires ( const T& t ) { Function( t ); };
// later use in MyClass<T>:
if
This site has 50+ post about the topic, several 'detection patterns' have had their successes through various epochs. With C++20 we should see quite some simplifications here.
So, what are the curr...
Let's say my adjacency list is as follows:
0 : 1
1 : 0
it's reverse should be empty because there is two arcs in the initial list:
0:
1:
or
0 : 1
1 :
becomes
0 :
1 : 0
another example:
0 :
1...
I wrote a simple test program to test Uniform Buffer, it runs normally on windows, but it runs wrong on macos.
on windows
show 36 quads
on macos
show 5 quads
Uniform Buffer layout in shader
struct
My Code :
std::atomic<int> x(22) , y(22);
int temp_x = -1, temp_y = -1;
void task_0(){
x.store(33, std::memory_order_relaxed);
temp_y = y.load(std::memory_order_relaxed);
}
void
I am trying to port Python Tensorflow model to C++.
In process, I need to convert the TF_Tensor class to cv::Mat.
I created the output tensor as the below.
TF_Tensor** OutputValues = (TF_Tensor**)m...
Is GCC allowed to reject the following code due to ambiguity? To me it looks like a bug.
It compiles fine with msvc, clang and icc.
See here: https://godbolt.org/z/9fsnhx
#include <iostream>
...
I have created a simple server client code using sockets in C/c++ .They run perfectly fine on same device in different terminals. How can I make them run in two different computers? Please explain in
In my current project I'm using the library libcurl, previously installed by powershell. I'm including it using #include "curl/curl.h" and compiling works but I have a linking error that ...
I am trying to start a worker thread using AfxBeginThread and wait until it finished. But I run into the issue, that I can either update the UI (show progress) without the thread conrol or wait for...
I have a problem with the code that uses function pointer that takes shared_ptr argument.
Here is a sample code.
header.h
#include <functional>
#include <iostream>
template <class T&...
I am trying to apply an image onto my triangle; however, the result shows that the triangle display as white color. I wonder if it is possibility that my code's color is overwrite the texture.
/*He...
I am experimenting with CRTP and mixing it with interfaces, and I cannot explain why this program crashes (in Clang, GCC and MSVC). In latest Clang and GCC it builds without warning with -Wall, -We...
Im working on a program that are accessing a SQL server.
I've established the connection, and i can get the stand i want, but only when my SQL Query is static.
I've read a post in here, where the s...