Category "c++"

Thread 1 "my_app" received signal SIGSEGV, Segmentation fault when accessing API from another library

From my C++ application my_app compiled using G++, I am invoking several API's from another shared library tool.so (tool.so also developed using C++). Each refe

Subtraction of two nullptr values guaranteed to be zero?

Is it guaranteed by the C++ standard that if I have two pointers of the same type whose value is equal to nullptr, that the difference between those pointers is

Subtraction of two nullptr values guaranteed to be zero?

Is it guaranteed by the C++ standard that if I have two pointers of the same type whose value is equal to nullptr, that the difference between those pointers is

Error occurs when linking with glfw3 [duplicate]

I've been trying to compile C++ code and dont reliant on IDE recently, and I decided to use an editor and command line to write and compile co

Send User Message to child window in CCtrlTab control

I have a dialog window (MainDlg : CDialogEx), in this window is tabcontrol (MyTab : CTabCtrl) and in this CTabCtrl I have child windows (Tab1Dlg : CDialogEx). T

C++ convert hex to std::vector<unsigned char> [duplicate]

I am using this code from Integer to hex string in C++ to convert std::vector to string to insert on a database. It is working, but now i need

Get name of type behind type alias in function template

I'm working with Visual Studio 2013. When I need to know what types the compiler deduced for my template parameters, I usually trigger a compiler error like thi

Avoid copying with reinterpret_cast the buffer?

I came across a code snippet where the bytes from a buffer were copied into a struct variable using memcpy(): MtaHeader m_hdr; memcpy(&m_hdr,&p_data[pos

How bad it is to lock a mutex in an infinite loop or an update function

std::queue<double> some_q; std::mutex mu_q; /* an update function may be an event observer */ void UpdateFunc() { /* some other processing */ std

fread a float array after a fwrite immediately will cause a file offset problem

Initial the integer array[] right line 21 will cause the failure of the data[] array fread from data.txt . int main() { FILE * file0 = NULL;

"gdstk.h No such file or directory"

Answered below! Thanks @drescherjm I am having some trouble generating the initial red rectangle in gdstk. I have copy-pasted source code below into a "Hello Wo

Is this pointer always a runtime construct

I am learning about the this pointer in C++. And i came across the following statement from the standard: An expression e is a core constant expression unless

Add Serialize to SFML Color

I am working on serialization of color data for SFML objects and ran into an issue where they are not supported by default, as they are not a default type. I tr

how to get a list of available monitors in windows 10

I want to get a list of available monitors in Windows 10, same as the monitor list shown in the System display settings (no matter whether they are attached or

Get exit status of a process in bash

I have a c++ executable named Test. I want to find out the GetExitCodeProcess() code when the execution is completed. I can find out the status code by writin

Prevent window from being clicked in while another window is open

On Windows, when a window opens on top of another window, the parent window will not be clickable, and will make a "ding" sound and its titlebar will flash. It

Can't open .txt file after compiling with CMake

I'm on MacOS and I'm coding a C++ project using SDL2 containing a src file main.cpp, a spritesheet.png and a .txt file. They're all in the same "src" directory.

Visitor Pattern and std::shared_ptr

I am using the Visitor design pattern in my application for message processing. For example: class AbstractMessageVisitor; class AbstractMessage { public:

msvcrtd.lib(exe_main.obj) : error LNK2019: unresolved external symbol main referenced in function

I am using gradle to build my c++ library I added this line to build.gradle file linkTask.linkerArgs.add("msvcrt${linkTask.name.toLowerCase().contains('debug

generic decorators for callable objects with conditional return

I want to write decorator functions for callable objects. This is what I have now: #include <utility> template <typename DecoratedT, typename Callable