C++ on Stack Overflow and Game Dev

1 answer

Initialize multiple rngs in a single program

I want to use multiple RNGs in my C++ application using <random>. What is the best way to seed them? I fear that the random numbers from different RNGs will be correlated too much when seeding ...

1 answers | 2 secs ago by knivil on Stack Overflow stackoverflow.com
1 answer

When to not create a separate interface (.h) and implementation (.c) in C?

I'm currently transitioning to working in C, primarily focused on developing large libraries. I'm coming from a decent amount of application based programming in C++, although I can't claim expertise ...

0 answers

How to link against v8?

I successfully compiled v8 javascript engine (on windows) ; now I try to follow the Getting started article but I am stuck at this point: Compile hello_world.cpp, linking to the static libraries ...

3 answers

Creating a QLineEdit search field for items displayed in a QListView

I want to create a search field that filters the items shown in a QListView. Basically the user could type in "foo" and only items with "foo" in the DisplayRole are shown. I already have a few ideas ...

3 answers | 1 min ago by jkyle on Stack Overflow stackoverflow.com
2 answers

Wait for signal while processing other signals

My Qt application talks to a serial device, and occasionally has to wait for this device to send a byte. To accomplish this, I create a new eventloop that exits as soon as there is information ...

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

Ambiguous call for overloaded function templates - even if one is more specialized?

Consider the following: #include <iostream> #include <utility> template <size_t N> using size_ = std::integral_constant<size_t, N>; template <size_t From> void ...

0 answers

What is the purpose of the integer “numberUsed” in this code?

I am trying to create a function using some of this code however i cannot figure out the purpose of numberUsed (relating to arrays). const int DECLARED_SIZE = 20; void fillArray(int a[], int size, ...

3 answers

How do I add a reference to an unmanaged C++ project called by a C# project?

One solution (the.sln) One C++ project (mycppproject.vcxproj in 2010or mycppproject.vcproj in 2008) which compiles a native DLL exporting some function(s). In debug this builds ...

2 answers

Maximum size of array of structs

I try to make array of structs. Struct contain two 2-dimensional arrays (100x100). If i want to make array of 30 or more structs the error occur - "Segmentation fault". I'm using CodeBlocks with MINGW ...

2 answers | 9 mins ago by A. Kwas on Stack Overflow stackoverflow.com
1 answer

Difference in type conversion between C and C++?

The last example in this tutorial regarding Implicit type conversion states that std::cout << 5u - 10; will produce 4294967291 rather than -5 due to type conversion. I tried this in both C and ...

1 answers | 9 mins ago by levengli on Stack Overflow stackoverflow.com
5 answers

C/C++ Converting a 64 bit integer to char array

I have the following simple program that uses a union to convert between a 64 bit integer and its corresponding byte array: union u { uint64_t ui; char c[sizeof(uint64_t)]; }; int main(int argc, ...

5 answers | 14 mins ago by tickferno on Stack Overflow stackoverflow.com
1 answer

PostThreadMessage C++ (CWinThread)

i'm using MFC C++ and I'm trying to send message to CWinThread using PostThreadMessage from Dlg Class and the message isn't handled on the thread class .H file of the thread: #define ...

1 answers | 15 mins ago by Shay Smadja on Stack Overflow stackoverflow.com
2 answers

Sum of values at common indexes in all subsets?

In a recent problem where i have to sum all values at common indexes in all possible subsets of size k in array of size n. For eg: If array ={1,2,3} Its subsets (k=2) will be (x [i] , x [j]) where ...

2 answers | 15 mins ago by wrangler on Stack Overflow stackoverflow.com
0 answers

Defining trait in parent class

I have a hierarchy of "codecs" to encode/decode various things to a binary stream. They all inherit from a parent Codec class, on which I'd like to define a few types, to use in the subclasses, as in: ...

0 answers

Passing binary Data to/from c++ to/from c# with SWIG

I have wrapped a c++ class with swig for c# use. My class is something like: public class DataHolder { public: void* BinaryData; long Length; } So basically the array will be created dynamically ...

3 answers

Passing arguments to another C++ source file

I have been trying to implement a class function for about a week now to no avail. Normally, I would be satisfied to put the logic in the header file, however, the ACML library conflicts with my use ...

1 answer

Error even after initializing?

#include <iostream> using namespace std; float* findAverage(int arr[][1], int rows, float averages[1]); int main (){ int myArr[1][1]; for (int i = 0; i < 2; i++){ for (int j = 0; j < ...

1 answers | 22 mins ago by DoeJ on Stack Overflow stackoverflow.com
0 answers

How to use type traits to define a partially abstract template base class?

I'm working on the following idea: There exists a generally abstract templated base class with mutiple template parameters. This class defines a contract guaranteeing the presence of certain methods ...

2 answers

Web Services using C++

I am building a server-client application that involves heavy signal processing (e.g. FFT). I have a working application written in C++/Qt, where everything (signal processing and other calculations) ...

0 answers

c++ class inheritance advice?

I'm designing a c++ program. The program a class called Sensors. In the class there are methods which reads linux system resources such as CPU used and disk space. I want to write these values into ...

8 answers

Comparison of arrays in google test?

I am looking to compare two arrays in google test. In UnitTest++ this is done through CHECK_ARRAY_EQUAL. How do you do it in google test?

4 answers

Initializing An Array of Unknown Dimensionality

I was surprised that I couldn't find this question existing. I've tried to generalize it (with some nice untested code) to something everyone can benefit from. Suppose I have a multidimensional ...

2 answers

Synchronize threads using mutex

I'm trying to understand C++ Multithreading and synchronize between many threads. Thus I created 2 threads the first one increments a value and the second one decrements it. what I can't understand ...

2 answers | 30 mins ago by Moez Rebai on Stack Overflow stackoverflow.com
1 answer

run time error with respect to execution of randomized quicksort

i'm trying to implement randomized version of quicksort.i have successfully used the normal version of quicksort,but now the g++ compiler says floating point exception (core dumped). How do i ...

1 answers | 30 mins ago by codeass on Stack Overflow stackoverflow.com
1 answer

Is it possible to disable HTTP Keep-Alive with libcurl?

I am implementing HTTP client for third-party private API. This API requires to not use HTTP Keep-Alive. Can libcurl disable Keep-Alive? Even when I set CURLOPT_FORBID_REUSE, it still sends ...

1 answers | 31 mins ago by Vitaliy on Stack Overflow stackoverflow.com
1 answer

<experimental/filesystem> in g++

I am trying to use filesystem. I have -std=c++11 -std=c++1y in my CMakeLists.txt. GCC version is 4.9.2. However, I have got an error: /home/loom/MyProject/src/main.cpp:5:35: fatal error: ...

1 answers | 34 mins ago by Loom on Stack Overflow stackoverflow.com
0 answers

JSON-RPC CPP in Windows with MinGW && Eclipse CDT doesn't generate header files

I'm completely new to JSON-RPC CPP. According to documentation, https://github.com/cinemast/libjson-rpc-cpp, it instructs to call jsonrpcstub as jsonrpcstub spec.json --cpp-server=AbstractStubServer ...

1 answer

menu callback in not called

I want to add a couple of buttons - "settings" and "restart" to my scene, placed above everything. I do the below [in my init()]: auto settingsMenu = MenuItemImage::create("settings_gold@2x.png", ...

1 answers | 38 mins ago by Moshe Shmukler on Stack Overflow stackoverflow.com
0 answers

dylib (mac os x dll) receiving a … VARIANT

I am under mac os x 10.10.5 with gcc 5.2.0, and I have a c++ dylib that will have to consume VARIANTs coming from the VBA of excel-2011 for mac. I would like to know what my strategy could be ? ...

0 answers

Run Eclipse formatter automatically like in Visual Studio

When I started serious programming, I was first used to working with Visual Studio, which had (to me) nice formatter settings keeping my code organized constantly. Eclipse has a good formatter, which ...

15 30 50 per page
1 2 3