Category "c++"

Excel XLL - how to register (xlfRegister) a function via its export ordinal?

I'm building an XLL for Excel, and am trying to register functions via XlfRegister. According to Microsoft's documentation , the target procedure to be invoked

Writing C++ without exceptions?

This answer mentions two ways to handle a C++ library (such as Qt) which is not exception safe: Isolate it in exception-safe wrappers Give up exceptions and ad

Does the C++ standard allow for an uninitialized bool to crash a program?

I know that an "undefined behaviour" in C++ can pretty much allow the compiler to do anything it wants. However, I had a crash that surprised me, as I assumed t

An invalid or unaligned stack was encountered during an unwind operation

I have a 64bit program that works with VirtualBox COM interface and implements a frontend for the virtual machine. Recently I started getting weird An invalid o

Qt serial port: write and read data

I'm able to connect to my serial port, but I need to read data from it all the time. It's working for about 39 minutes, but after it stops at line serial.flush(

qt exec() cannot be closed

I am coding in C++ with Qt5.7. I are facing a problem with QDialog exec(). I need it in modal, so I cannot use show(). When the dialog is finished and closed, t

Copy child object to parent object

I have three classes: Shape, Rectangle and Circle. Shape is parent of two other class. definition of this classes is in following code: #include <iostream>

Allegro 5 font display problems

Using Allegro 5 (5.0.10-1), for some reason text is displayed in a really strange way - it's cut off at certain parts and letters are sometimes not on the same

How to return the directory of the cpp file?

I am trying to return the path of the cpp file I am running. Does anyone know a method or a way to implement this? For example lets say I have this file test.cp

How to include omp.h in OS X?

I'm new in C and have some problems compiling my code in OS X. I code Java a lot both in Eclipse and use terminal to compile my code. However now I'm learning

Is there a direct way to get clear details on gcc acceptable option values (e.g. for -std) without grep-ing through irrelevant material?

The gcc (or g++) compiler has a -std option to specify the language standard to use for compiling C or C++. At the top level one can see that this option exists

How to check if a struct is NULL in C or C++

i have the following structure typedef struct { char data1[10]; char data2[10]; AnotherStruct stData; }MyData; for some reason the imple

What is the difference between using a Makefile and CMake to compile the code?

I code in C/C++ and use a (GNU) Makefile to compile the code. I can do the same with CMake and get a Makefile. However, what is the difference between using a M

How can I write an LLVM pass to detect redundant conditions in C / C + +

I want to write an LLVM pass to detect redundant condition pattern like this in c++. int a = ... , b = ..., c = ... //first if condition if(a == b + 1 - c){

How to get not normalized MNIST dataset PyTorch C++

I'm trying to follow this C++ PyTorch example but I need to load the MNIST dataset with its standard values, between 0 and 255. I removed the application of the

Could not start debugger. Could not run 'lldb-mi'. Make sure that the path name is specified correctly

I'm facing this error when launching the C++ debug on KDevelop. Where does this error originate? Any idea would be appreciated. thanks.

Move-only version of std::function

Because std::function is copyable, the standard requires that callables used to construct it also be copyable: n337 (20.8.11.2.1) template<class F> funct

How to create a time point from milliseconds since Unix epoch?

To create a time point for the current time, you can use: std::chrono::system_clock::now(). I cannot figure out, however, how to create a time point given milli

How does #include <bits/stdc++.h> work in C++? [duplicate]

I have read from a codeforces blog that if we add #include <bits/stdc++.h> in a C++ program then there is no need to include any other h

Does cross-platform C++ require building separately on every single platform?

My question actually has two variants, but for some context, I have a C++ *.DLL that I use with Unity using P/Invoke. It's built on Windows 10 with MSBuild (pla