C++ on Stack Overflow and Game Dev

9 answers

switch/case statement in C++ with a QString type

I want to use switch-case in my program but the compiler generates an error. How can I use the switch statement with a QString? The compiler gives me this error: switch expression of type 'QString' ...

9 answers | 54 secs ago by woody on Stack Overflow stackoverflow.com
2 answers

Understanding arrays and pointers in recursive functions

I have to write a recursive function that will check if two given arrays of the same size have the same elements but they could be in different order. I thought the most elegant solution would be to ...

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

Error compiling simple C++ program

im trying to compile my first program in c++, it's a pretty simple code and i dont get why it dont compile and give me lots of errors: #include <iostream> using namespace std; int main () { ...

1 answers | 5 mins ago by Levenlol on Stack Overflow stackoverflow.com
0 answers

Getting Marker Coordinates in ARToolKitPlus

I have a really basic question, however I could not find the answer in the documentation or on the web. I want to use ARToolKitPlus (https://launchpad.net/artoolkitplus) to get the positions of ...

1 answer

Hooking with DLL a game hook

My DLL #include <windows.h> #include <vector> #include "Funkcje.h" WNDPROC originalProc; LRESULT CALLBACK myHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); BOOL WINAPI ...

1 answers | 11 mins ago by VereX on Stack Overflow stackoverflow.com
1 answer

find-package to a development library using CMAKE

This is a total cmake noob question I'm sure. I'm working on an OpenCV project and wish to test something using the latest beta release. How can I specify the beta libraries without installing them ...

1 answers | 11 mins ago by wentbackward on Stack Overflow stackoverflow.com
4 answers

Are there any gotchas or limitations when template aliasing shared_ptr and unique_ptr?

For the simple reason of cutting down on typing something like: std::shared_ptr<...>; std::unique_ptr<...>; every time I want to use smart pointers, I thought about using template ...

0 answers

Service to write to file

Following the sample windows service here https://code.msdn.microsoft.com/windowsapps/CppWindowsService-cacf4948 I want the service to write to a file. So i modified void ...

0 answers

Insert CVD::glRect in CVD::image

I would like to draw a rectangle in a CVD::Image. I defined the rectangle using the instruction: glRect (const ImageRef &p, const ImageRef &q) ...

34 mins ago by RMG on Stack Overflow stackoverflow.com
2 answers

How to write a recursive function to calculate shortest path in a graph data structure

Single source shortest path. Given a specified vertex, calculate the shortest path to it for all other nodes. I know there is Dijkstra and Floyd algorithms. But i'm thinking if there is a recursive ...

2 answers | 37 mins ago by scott on Stack Overflow stackoverflow.com
0 answers

Negamax algorithm

I have worked quite a bit with my tictactoe, but never got it working. Here is what I have so far: static int evaluate(board b) { if (is_win curr_move_noughts) { return 1; } else if (is_win ...

39 mins ago by coder111 on Stack Overflow stackoverflow.com
0 answers

Using hdfs in Visual C++

I'm trying to make a simple program reading data from a source and writing them on an Hadoop single node cluster (configured in a Windows 7 environment). The code I want to use is similar to the ...

2 answers

Share object across members

I'm trying to make the following example code work. I've read thru several tutorials and Q&A's, but I can't get it to work. In all likelyhood my understanding of classes are lacking, but I learn ...

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

How to print the value of a sub-string each time it occurs in another string in Qt?

I'm working on a qt project, I have a sub-string and I want to search for this string in another string and print it each time it occurs. I have a string 1234-1456-11234-1 I want to print a each time ...

1 answers | 50 mins ago by shahd ewai on Stack Overflow stackoverflow.com
3 answers

Custom support for __attribute__((format))

Both GCC and Clang have a support to make compile-time checks on variable argument functions like printf. These compilers accept syntax like: extern void dprintf(int dlevel, const char *format, ...) ...

3 answers | 50 mins ago by prapin on Stack Overflow stackoverflow.com
1 answer

Qt wizard back button Ui issue

I'm new with Qt and I'm making a little application. I've do it with QWizard and QWizardPages. I Have added 2 CustomButtons to the wizard so it has 5 buttons down: ButA, ButB, Back, Next/Finish, and ...

1 answer

computing angle between two 3d vectors - how to implement

I would like to compute the angle between two 3d vectors. I'm using the following equation to achieve this: diffangle = atan2(norm(cross(v1,v2)),dot(v1,v2)) The components of v1 and v2 are given in ...

0 answers

Library versions string in autoconf

What is correct way of specifying a library version for first time in autoconf? The library is in unstable status and I suppose it's gonna be 0.1.0 until it's prepared for the public API which should ...

1 answer

C++ Memory Counting in OpenCV

I have an application written in OpenCV. It consists of two threads that each perform an OpenCV function. How can i determine how much memory each thread is generating? I'm using libdispatch, Grand ...

2 answers

Why can't use std::get<0> in std::transform?

In trying to compile the following code which would copy a maps keys to a vector: map<string, string> mss; vector<string> vs; transform(mss.begin(), mss.end(), back_inserter(vs), ...

1 answer

What is the total thread count(executed over time, not parallel) for CUDA?

I need to execute a function about 10^11 times. The function is self-contained and requires one integer as input, let's call it f(n). The range of n is in fact 0 < n < 10^11. We can ignore ...

1 answer

how to declare label in global class (helloworld.h) with cocos2d-x v3.2?

I'm creating a 2d platform game with cocos2d-x v3.2 (c++) and i'm using label. cocos2d-x v3.0 (c++) declared like cocos2d::LabelTTF* currentScore; cocos2d-x v2.2.2 (c++) declared like ...

2 answers

Something wrong with converting SDL surface to GL texture

I can't find my mistake, why text has not been created? When using texture instead of text I get nothing or black background with colored points, please help GLuint texture; SDL_Surface *text = NULL; ...

2 answers | 1 hour ago by Binary Mind on Stack Overflow stackoverflow.com
1 answer

manual for mysql connector/C++

I have come across several documents on using mysql connector/C++ with all of them using different functions for the same things. e.g `sql::mysql::MySQL_Driver *driver; sql::Connection *con; driver ...

1 answer

replace the occurrence of character with a seq number using boost

How can i replace multiple occurrences of a character with a string containing the occurrence number. e.g if i have the following expression. insert into emp values(?,?,?) I want the following ...

1 answers | 1 hour ago by Mohit Thakur on Stack Overflow stackoverflow.com
0 answers

QTCreator designer widget need hide QWidget properties

I ve implemented non QWidget based Control. Works fine, but I need to make a component without QWidget properties. Something like QVBoxLayout. Is there some way to hide propeties of QWidget?

1 answer

C++ and directx 11 Error no symbols loaded for dxgi.dll

I started to lean c++ and directx11 a few days back. So I am no expert at it. .Please be kind enough to explain me why it had occurred ... I created the window and stuff correctly.Even the Swapchain ...

1 answer

Adding intrinsics using an LLVM pass

I've added an intrinsic to an input code using an LLVM pass. I'm able to see the intrinsic call, yet I can't figure out how to compile the code to my target architecture (x86_64). I'm running the ...

1 answer

Unable to Send data from Server to client on local network in C++

I need to communicate between two systems on local server. So, I decided to use "Socket" programming in C++. For this I follow this tutorial. I make some changes according to my need like changing ...

3 answers

Convert c++ char array to c# string

I have a struct in C++ which has a char[10] field. struct Package { char str[10]; }; I convert the struct into char array and send it to and c# application over a TCP socket and there I convert ...

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