C++ on Stack Overflow and Game Dev

0 answers

Prefix increment operator error C++

I'm guessing it's to do with precedence but why is this legal vector<string>::iterator iter = vec.begin(); iter++->empty(); But this is not. vector<string>::iterator iter = ...

0 answers

How to get updated text from edit control inside wndproc?

I am currently having a problem where I have a Textbox (Edit control), that I wish to retrieve the text from inside its WndProc. I cannot find any message/flags of any kind that would enable this. ...

2 answers

C++ struct constructor with member initializer list

I came across a C++ struct definition with a constructor. struct Foo ...

2 answers | 5 mins ago by liv2hak on Stack Overflow stackoverflow.com
1 answer

std::string optimal way to truncate utf-8 at safe place

I have a valid utf-8 encoded string in a std::string. I have limit in bytes. I would like to truncate the string and add ... at MAX_SIZE - 3 - x - where x is that value that will prevent a utf-8 ...

1 answers | 6 mins ago by gsf on Stack Overflow stackoverflow.com
1 answer

C++ | 'Command Console'?

I am wanting to make a command like console that can take arguments. For example: Console> tp player1 p2 Teleported player1 to p2 Console> I am not sure how to get the parameters of commands ...

1 answers | 8 mins ago by Hiyper on Stack Overflow stackoverflow.com
2 answers

Stream Manipulation for outputting object data in different formats

Say I have an employee object with the following data members: class Employee { private: int _id; std::string _name; std::string _address; std::string _city; std::string _state; ...

2 answers | 11 mins ago by Bryan Gurney on Stack Overflow stackoverflow.com
2 answers

Linking error when compiling Crypto++ for ARMHF

I'm trying to compile the crypto++ library to run for the armhf architecture. I'm following the method provided in this answer. I tweaked the setenv-embed.sh to match my system's configuration. The ...

3 answers

Creating const objects of user class from const pointers

Is it possible to force compiler propagate const-qualifier in my class, in order to supply const-pointers to the constructor? Consider the following code: struct T { T(int * a, int * b): ...

3 answers | 16 mins ago by random on Stack Overflow stackoverflow.com
9 answers

dynamic_cast and static_cast in C++

I am quite confused with the dynamic_cast keyword in C++. struct A { virtual void f() { } }; struct B : public A { }; struct C { }; void f () { A a; B b; A* ap = &b; ...

9 answers | 16 mins ago by Vijay on Stack Overflow stackoverflow.com
0 answers

Disable g++ pragma message

I'm compiling a C++ project with gcc version 4.9.2 (Debian 4.9.2-10). The project uses the cpp_netlib library which includes boost spirit. It outputs a lot of # pragma message("NOTE: Use of this ...

0 answers

How to render Spotify PCM stream on Windows

Currently I am trying to use the libspotify lib to write a Windows Spotify Player. I'm new to audio streaming but not to video streaming. I have the basics working for most of the user data and ...

2 answers

how to fix error C2460 in c++?

#include<iostream> using namespace std; struct link { link data; link* next; }; class linklist { private: link* first; public: linklist() {first=NULL;} void additem(int ...

2 answers | 23 mins ago by Ahmed Samaligui on Stack Overflow stackoverflow.com
1 answer

Include only the necessary functions from libpcap

I have a C++ JNI Library (that I did not write myself) that uses the functionality of libpcap. There are only a few functions that are actually being used from libpcap but when the library is ...

1 answers | 30 mins ago by Chris on Stack Overflow stackoverflow.com
2 answers

Connecting to MS Access database using C++ using Visual Studio 2008

I need some serious help trying to connect to an Access database using VS 2008's C++. I have done this in C# but I cant figure this out in C++. I need to use C++ for the connection because I am ...

0 answers

c++ unit tests of the same type

I am a new in C++ area, and I am trying to create some unit tests. I have a difficulty to create and implement the test which is about the same type as follow. For example: I want to test the name and ...

1 answer

Why doesn't my boost::spirit rule compile for parsing a list of lists?

I'm trying to write a parser for Open Inventor .iv files using boost::spirit. I have the following struct for VertexProperty nodes: struct VertexProperty { ...

2 answers

Is it possible to provide different definitions for a virtual function of a replicated base?

I am aware of the statement, "A virtual function of a replicated base class can be overridden by a (single) function in a derived class." I am curious to know if it is possible to provide more than ...

0 answers

Remove Qt widget layout's margins

I want to remove the spacing marked as red lines in the screenshot. I set layout's contents margins to (0,0,0,0), re-sized parent widget to minimum but still can not get rid of those spaces. This only ...

2 answers

Translating java byte array to C++

i am trying to translate a java class into C++ and i have some trouble : public class IntDecoder { int pos = 0; boolean half = false; byte[] bytes; .... What is the equivalent ...

2 answers | 34 mins ago by tevlon84 on Stack Overflow stackoverflow.com
0 answers

How to make cuda-memcheck return non zero when there is a leak check error

I am on Ubuntu 14.04 with CUDA 7.5. Suppose I have the simple code int main() { float *test; cudaMallocManaged(reinterpret_cast<void **>(&test), 100 * sizeof(float), ...

0 answers

Initialization of a return value should ignore constness of automatic object

Adhering to const correctness, you might want to make your local object of type unique_ptr const as in the following, whereas T is some here unimportant type: unique_ptr<T> foo() { const ...

2 answers

#include <zbar.h> 1 error generated when running pip install zbar

I'm trying to run pip install zbar and for some reason I can't seem to find an answer to solve this dependency issue. Any help would be extremely appreciated. See traceback below: ...

2 answers | 42 mins ago by Matt on Stack Overflow stackoverflow.com
6 answers

base64 decode snippet in c++

Anyone have a freely available base64 decoding code snippet in c++?

6 answers | 45 mins ago by joeld on Stack Overflow stackoverflow.com
15 answers

Parsing a comma-delimited std::string

If I have a std::string containing a comma-separated list of numbers, what's the simplest way to parse out the numbers and put them in an integer array? I don't want to generalise this out into ...

15 answers | 47 mins ago by Piku on Stack Overflow stackoverflow.com
3 answers

C++ calculate median with reference

I try to calculate the median of a vector called median: std::nth_element(median.begin(), median.begin() + median.size() / 2, median.end()); medianVal = median[median.size() / 2]; cout ...

3 answers | 49 mins ago by black on Stack Overflow stackoverflow.com
0 answers

Can't use SDL2 variables in Block scope

I'm programming with SDL2, but I cannot grasp the reason behind the following. This works: SDL_Window *window; SDL_Surface *screen_surface; SDL_Surface *picture; auto initWindow(void) {…} auto ...

13 answers

How do I best silence a warning about unused variables?

I have a cross platform application and in a few of my functions not all the values passed to functions are utilised. Hence I get a warning from GCC telling me that there are unused variables. What ...

13 answers | 52 mins ago by Phil Hannent on Stack Overflow stackoverflow.com
0 answers

Accessing Qt ui-> from a static function

I have a static function which I'm trying to update a QLable inside but I can't access ui from a static function. I get the following error: error: invalid use of member 'Camera::ui' in static member ...

58 mins ago by WhatIf on Stack Overflow stackoverflow.com
1 answer

comparing two files byte-wise

Here http://www.cplusplus.com/forum/general/94032/ I found a great and fast method to compare two files byte-wise. But it has boost dependency. I am now working on a program in Qt. Is there a ...

1 answers | 1 hour ago by V.K. on Stack Overflow stackoverflow.com
1 answer

Matlab coder unsupported functions

I'm trying to convert a piece of MATLAB code into C++ via MATLAB coder. Many of the functions in the MATLAB code like imread, imshow, normcorr2 are not supported by MATLAB coder. What are some ...

1 answers | 1 hour ago by bakalolo on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3