C++ on Stack Overflow and Game Dev

2 answers

Why OpenMP under ubuntu 12.04 is slower than serial version

I've read some other questions on this topic. However, they didn't solve my problem anyway. I wrote the code as following and I got pthread version and omp version both slower than the serial ...

3 answers

Returning two dimensional array of strings

string** flowFile() { string line; string word[8]; int i=0; static string flow[23][2]; ifstream myfile ("test.txt"); if (myfile.is_open()) { while ( getline ...

8 mins ago
0 answers

Program using shared library and sf::Window not entering main function

I added some layers to the SFML library. I wanted to make it a shared library that others programs should use. Problem is, when I try to use a function inside this library, the main function is not …

10 mins ago
0 answers

16 ERRORS in XCODE using SDL 1.2

I have recently begun programming in C++, and now want to implement a third party API in order to start working with games. I have chosen SDL 1.2. I Downloaded the package, extracted SDL.framework and …

12 mins ago
1 answer

Need some help compiling “Hello World” in g++

I recently took the plunge into Debian and wanted to begin translating my code over from visual studio to vim/make/G++. I'm running Debian wheezy and have installed G++ 4.7.2 (came with debian, can't …

20 mins ago
0 answers

how do I implement bubblesort using a vector

I'm having some serious trouble getting this program to work. I know my question isn't exactly specific but I don't know where else to go. This is what i Have so far. Insert, size, erase, find, and …

4 answers

inline functions vs normal functions

I am fairly new to C and C++ and I am trying to understand about functions. I came across this term called inline function and understand it as when a function is declared inline, the compiler pastes …

0 answers

class members restricted after converting to template

So I'm working with templates and I've run into a problem. After I converted my code into templates I am no longer able to access the private members of my classes. I get the error that 'current' is a …

23 mins ago
1 answer

Unable to write to files in C++ dll project under C# Windows Application

I have a C++ dll project, which will be called by the C# Windows Application. But each time when I tried to write to files in the C++ dll project, I will get the following error: An unhandled ...

0 answers

Is the expression 'decltype(MyTag::non_static_m.test + 1)' good syntactical?

The question is the commented lines' in the code below: struct MemberType { int test; }; struct MyTag { MemberType non_static_m;// Note that it's NOT defined with 'static'. }; int ...

28 mins ago
2 answers

What is the recommended way to detect that a Control+some-key has been pressed?

Let's say that I desire to catch the Control-A combination. This is my code so far, in a Windows Hook function: KBDLLHOOKSTRUCT kbdStruct = *((KBDLLHOOKSTRUCT *)lParam); if (kbdStruct.vkCode == ...

36 mins ago
3 answers

how to check whether the variable values matches or not?

i am having problem in checking whether variable value matches or not. i am using if statement to check whether health variable is having excellent as value or not but the below code gives error. ...

41 mins ago
11 answers

Memory Allocation for Recursive Functions

How is memory allocated when recursive functions are called? A function has it's own allocated memory. When it is called, the parameters (not reference-passed ones) and variables get memory. So when …

2 answers

Which way to test for signed integer overflow on multiply?

Which if any of the following does "the right thing" in a standards-compliant manner? You can assume that m and n are of type int (signed integer). The main issue is signed integer overflow. Sample …

1 hour ago
2 answers

Find the library that a specific function is defined in

Somebody sent me a piece of C++ code, and it includes some headers and functions that I'm unfamiliar with. I want to find which header file defined a particular function. For example, I have these ...

1 hour ago
1 answer

boolean fix initializer expression list treated as compound expression devc++

The code works without the boolean but it always returns true,whether it works or not. I wanted it to return false if it didn't execute successfully so i could later decide what to do. #include ...

2 answers

Horizontal sum of 32-bit floats in 256-bit AVX vector

I have two arrays of floats and I would like to calculate the dot product, using SSE and AVX, in the lowest latency possible. I am aware there is a 256-bit dot product intrinsic for floats but I have …

0 answers

Frameworks to connect a webapp (HTML5/JS) and native app (C++)

Me and my team are developing a menu (should be built using HTML5/JavaScript) for our C++ games. It also requires passing of data for both the applications: Menu and Games. We want a real-time ...

2 answers

Copying a Linked List crashes the Program

I have Linked List code, the Copy_List function crashes the program and won't work: it gives no syntax error so it's logical. I'm not sure where the exact problem lies, so any help would be ...

1 hour ago
0 answers

Microsoft Visual C++ Runtime Library - Runtime Error - How to suppress the error

It looks like a duplicate, but believe I checked other answers, nothing worked. My application started crashing while closing the application with below error. It was working properly few days back, …

1 hour ago
16 answers

One 'else' for nested 'if' statements

I've got a problem which can be simplified to this: parameters: a, b if (a > 5) { Print("Very well, a > 5"); if (b > 7) Print("Even better, b > 7"); else { …

1 hour ago
2 answers

Class function with a pointer parameter not saving to vector

I wasn't exactly sure how to title this, but basically, I have this class function that is designed to add a new ability to the vector of abilities in the class. public: vector <Ability*> ...

1 hour ago
1 answer

Need examples for FtpGetFile, not working

This is my current code but it doesn't do anything. Also i wanted it to open do.bat after downloading is complete #include <cstdlib> #include <iostream> #include <wininet.h> using …

0 answers

Robust edge detection OpenCV

I have been using this method to find a card and crop it out of the image: void findCardAndCrop(Mat& bw,Mat& outerBox) { // Remove noise GaussianBlur(bw, bw, cv::Size(11,11), 0); …

1 answer

null character in encrypted data (openssl)

Is it possible that after cbc encryption, null character appears in the resulting multibyte data. If yes, what precaution should I take to avoid it.

1 hour ago
2 answers

How exactly does a programming language interact with a scripting language?

Ok lets say you designed a game in c++ and used lua as well how exactly does the c++ portion of that game interact with the lua code. My main question that I have the most trouble understanding are: …

1 hour ago
1 answer

C++ Pointer Inquiry

So I've been fooling around with statics, pointers and typedefs and I've run into a brick wall and was wondering if someone could offer some insight. I have a class Utilswith a static ofstream called …

2 hours ago
2 answers

How to pass a file into a function?

i am having difficulty understanding how to pass a file into a function. i have a file with 20 names and 20 test scores that needs to be read by a function. the function will then assign the names …

2 hours ago
0 answers

doxygenating array elements

I have looked through the behemoth that is the doxygen manual and have not been able to find a way to enumerate individual elements of an array in documentation. I have an array as follows: /*@brief …

2 hours ago
2 answers

Creating shared library through g++ how to

Where is the official "how to" about creating and understanding technics used in dynamic library. I'm using g++ compiler. I've googled this question but I can't find anything official about this.

2 hours ago
15 30 50 per page
1 2 3