Newest 'c++' Questions

Q&A for professional and enthusiast programmers

Qt5 Dll in VBA with error Run-time error 453

How I can create DLL in Qt 5 to use it in VBA? I have simple class: dllvba.h #ifndef DLLVBA_H #define DLLVBA_H #include "dllvba_global.h" class DLLVBASHARED_EXPORT DllVBA { public: DllVBA(); ...

Given a huge file of words, How to print all distinct words in it, in ascending order? [on hold]

Given a huge file of words, How to print all distinct words in it, in ascending order (huge means wont fully fit into memory). Any suggestions are welcome about algorithm and data structure only ...

How to control Raspberry Pi's GPIO pins from separate PC

In my application I want to turn on certain GPIO pins that are on the Raspberry Pi from my PC's C++ script. My PC is currently running on Windows 10 and my Raspberry Pi on Raspbian. The general idea ...

Chained anonymous object creation on the heap

I'm writing some arduino libraries and would like to improve readability / add some syntactic suggar. What I would like to do is create objects on the heap in a way that would look like: Panel panel(...

CUDA in VS2013: Setting the correct compute capability

I am new to CUDA and just wanted to configure VS2013 to be able to use all the nice features of compute capability 6.1 (GTX 1080) like automatic memory management. CUDA 8.0 is installed. Under project ...

C++ Void Call Timeout

I`ve got a problem with my C++ application on a Raspberry Pi. This script should print a distance in cm one time before terminatig. But it should also check if the ultrasonic sensor is connected and ...

Does the C++ standard actually guarantee that the operand to a throw expression provides the thrown value?

While reading about the details of exception handling in the standard, I noticed that it doesn't ever seem to actually specify that the operand to a throw expression will provide the value for the ...

MSSQL ODBC refusing valid TINYINT values (Numeric value out of range)

I'm trying to insert into a TINYINT column which according to MSDN docs should take numbers between 0-255. Unfortunately it only takes 0-127. If I try to insert 128 or higher it complains: [22003] (...

Which UI item allows dynamic expansion on the go in Qt?

Suppose I have a single text box and a radio button placed below the text box . What I want is that if the user enters some text and ALSO clicks the radio button a similar text box and a radio button ...

How do I add line numbers to a WinAPI UI [on hold]

I would like to be able to show the user of my program what line he is currently on while writing in the input. If you're unaware of what im talking about, here's a screenshot: Thanks in advance.

C++11 thread pool example with bug

Below is some code showing a simple and short implementation of a thread pool. The code is inspired by this post. I compile it with clang++ -std=c++11 threadpool.cpp -o threadpool -lpthread When ...

Choose template function based on existence of member

Let's say you have these two classes: class A { public: int a; int b; } class B { public: int a; int b; } class C { public: float a1; float b1; } enum class Side { ...

RT audio Mac error g++ compiling error

Having problems getting rt audio to compile using simple application #include "RtAudio.h" int main() { RtAudio *audio = 0; audio = new RtAudio; delete audio; return 0; } to ...

Using multiple fonts types in console application with WinAPI

I'm writting a console application using WinAPI and I noticed a strange behavior of SetCurrentConsoleFontEx function. The app uses two types of fonts: // small font CONSOLE_FONT_INFOEX font0; font0....

Non const anonymous reference in constructor [duplicate]

I've looked quiet some time but I find it hard to find an answer to this problem* which I think someone with more c++ experience finds pretty obvious. Consider this class: class A { public: ...

Any idea how to solve the LNK2019 - unresolved external symbol, error?

I have this annoying error and have no clue on how to resolve the issue; I am using Visual Studio 2015, community version. I am making a C/C++ console application that attaches to the GTA5.exe and ...

euler 36- why is the final sum wrong? [on hold]

the following program is not giving the correct answer. But the numbers it is displaying are correct but the final sum is incorrect.My only guess is that it is not displaying complete solutions. What ...

Hiding standard library warnings count from clang-tidy output

If clang-tidy outputting the following checks result: 609 warnings generated. Suppressed 609 warnings (607 in non-user code, 2 with check filters). Use -header-filter=.* to display errors from all ...

“pure virtual function called” on gcc 4.4 but not on newer version or clang 3.4

I've got an MCVE which, on some of my machines crashes when compiled with g++ version 4.4.7 but does work with clang++ version 3.4.2 and g++ version 6.3. I'd like some help to know if it comes from ...

server implementation in C++ to support AngularJs client

I am required to implement a server on C++ code running on Linux to support Angular JS client. What are the options available ? Shall I use c++ to implement server over raw socket, boost-asio server, ...

Connecting program to dictionary

I'm writing this program for the game "Scattegories" and I would like to connect some sort of dictionary (to check if the words exist) to the program. If I were to do that how would I do it? // A ...

p2p tcp connection with poco

I'd like to make p2p connection. 2 clients connects to server I'm using poco TCPServerConnection for server and StreamSocket for client. First connected client(A) will be a server in A-B connection....

So what does the function SDL_FreeSurface do?

I'm learning SDL/C++ right now, just wondering what does it do, I checked the definition of this function, but I'm still not very clear about it, if anyone knows, please explain to me in a simple ...

Converting UInt8 C++ values to C# byte array

I have a 1-dimensional C++ array containing UInt8 values - I would like to convert those values and place them into a 2D C# byte array. Currently, my code is giving me incorrect values. Here is my ...

How to calculate accrual interest for FixedRateBond using Quantlib? (I am a Beginner)

I have par value, issue date, maturity date, settlement date, coupon rate, yield as input. Please try to explain it in detail as I am using Quantlib for the first time.( http://realanalysiszone.com/?p=...

Recursion to iteration without rebinding a reference

I have a function which, cut down, looks like: // bar is basically a linked list with extra stuff tagged on void recurses(std::unique_ptr<bar> & P) { bool ok = ...

where is my wrong in this code? [on hold]

#include <iostream> #include <windows.h> #include <fstream> #include <string> using namespace std; int main() { std::string a = ""; std::string c = ""; int b = 0; ...

Unresolved external symbol “*” referenced in function _main

I´m a linux user and I dont have much experience with programming under Windows so i pressume it's a problem with Visual Studio, which i have to use, or something like that... I have really simple ...

how can I draw a arc with goocanvasmm

Is it possible to draw only a part of a circle with goocanvasmm: m_ellipse = Goocanvas::Ellipse::create( x, y, radius.x, radius.y ); root->add_child( m_ellipse ); works fine and draw a full ...

CMake Add (Test) Executable

I would like to create two executables: one executable for the application, and one for the testing of the application. To that end, I have the following in my CMakeLists.txt file: ...

Outputting differences in arrays

I have to make a code where the user inputs altitude readings and the code is supposed to output total climb, total descent, and net change. This is what I have below. I can't figure out how to code ...

Read vector from config.ini file

id = 1 [controller] controller_ip = 192.168.16.9 [m] instrument = A B C How to read this config file using boost, such that I finally want a vector instrument containing strings A, B and C? I was ...

How to display a value entered in a specific position in a for loop in C++?

How can I cout the number that is entered by the user in the 3rd position from the loop below the actual loop is much bigger and the position is different but I just want a example: C++ Snippet:

a cuda kernel with two different threads indexes

I am writing a kernel in CUDA that uses two different threads. here is How the scenario goes. I have 3 parameter arrays (alpha, beta, sigma) that each have the size of 64. And I have an array of ...

C/C++: Multiplatform modifiable GUI application - Win/Linux [on hold]

Hellou guys, dear community. Im just working on implementation plan for application aimed to collecting and processing information from sensors/devices connected via USB or another communication ...

A C++ container with being smaller and bigger feature

For a program I need a container that can be very flexible so that if I have such a container named X this way: X: |1|2|+|8|/|4|-|3| (12+8/4-3) I will be able to resize (after first step of ...

Working on Array inside Struct , with Assembly

Im trying to check the even numbers from an array inside a struct, but i dont think i wrote something right. When debugging, (i.e. count = 3 v[] = {1,2,4}), after it reaches " cmp eax,[ebp+12] and je ...

OpenGL Quaternion Rotation Matrix

I am creating my own rotation matrix to be used in OpenGL and when I use a quaternion based rotation system, the cube that is being rotation will have a distorted shape over time if i do not normalize ...

How to make a lambda function friend of a class?

I was trying to make a class that takes as argument in the constructor a lambda function, and I want this function to be friend with the class. The code for the class looks like this: using func = ...

How to generate debug symbols for android native app?

i do first steps in developing for Native Android and need some help. I copy armv7 gdbserver to my phone and compile "hello word" test app written with C++. And now i want to debug my app with gdb ...

Sort two arrays by 1 element everytime

So I have these 2 arrays: {2, 4, 5, 8, 9} {1, 3, 6, 7} The 2 arrays are always going to be defined in a consecutive matter (1, 2, 3, 4, … not 1, 8, 2, 5, …); What I need to do is get ...

Root getting changed unknowingly c++? [on hold]

I dont know why this code gives wrong output if character pointers are used.character array gives proper output. This code is to create a node and make a tree . If character pointer are used the root ...

Why do I keep getting 0? [on hold]

This for loop should be either 0 or 1 and it is consistently 0 for whatever reason. Is there any way someone could help explain why I'm wrong? for(int s = 0; s < h; s++){ for (int j = 0; ...

Interfaces and public methods

I have a struct that I use a pure abstract interface (only public methods and they're all =0), an abstract class to hide implementation details and two specialisations that inherit from it. I'd like ...

Getting exception when writing UTF-8 BOM

I have to manually add a UTF-8 BOM to a simple text file. However, I'm not able to write the BOM with the following method. With my rather limited c++ knowledge I actually do not understand what I am ...

Error:Execution failed for task ':app:compileDebugNdk' Error: Your project contains C++ files but

So i tried to ' RUN ' my app to the emulator and this error showed up Error:Execution failed for task ':app:compileDebugNdk'. Error: Your project contains C++ files but it is not using a ...

Suggestions for program/script to log hours

This is a slightly open-ended question, but I'm looking for general guidance on how to approach this problem, because I don't really know where to start: With my current employer, I need to log my ...

Characters supported in C++

There seems to be a problem when I'm writing words in foreign characters (french...) For example, if I ask for input for an std::string or a char[] like this: std::string s; std::cin>>s; //if ...

OOP: object casting inside ctor vs passing object's members into ctor

Lets say I have two hierarchies of classes. The the second one uses the first one. Here is a synthetic example which illustrates the question. The first hierarchy: struct One{}; struct Two{}; ...

C++ AES Decryption (for learning purpose)

I'm trying to encrypt a plain-text message using AES encryption. So far, I am able to encrypt my plain-text without any problem. Checked it against some trust-able online AES encryption website. ...
Translating... 0%