C++ on Stack Overflow and Game Dev

0 answers

(Help) Error in function 'WinMain' in Eclipse CDT

I was trying coding a simple Win32 GUI Application using Eclipse CDT (Eclipse used in C++) but it throws an error which says: 'conflicting declaration of C function 'int WinMain(HINSTANCE, int, LPSTR, ...

1 answer

passing uniform float into vertex shader opengl

I am having a problem passing a float from c++ by using uniform in to my vertex shader. This float is just meant to keep adding to itself. Within my header i have float pauto; void pautoupdate(int ...

1 answers | 17 mins ago by vyrix09 on Stack Overflow stackoverflow.com
2 answers

Compiling three C++ files. Linking error

I'm in OSX Yosemite, and I have three C++ files I'm trying to compile. BinModel01.cpp #include <iostream> #include <cmath> using namespace std; double RiskNeutProb(double U, double D, ...

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

Is there a memory leak in the following c++ code?

I am writing my program for my DataMining project. I get segmentation error on my code. I tried to debug using the gdb and created core dump using ulimit in ubuntu. Below is the error I was able to ...

1 answer

Change default CMakeLists.txt in CLion to include warnings

In CLion the default CMakeLists.txt sets the C++11 compiler flag only. I'd like to have warnings and the pedantic flag by default in all my projects. This is by default set(CMAKE_CXX_FLAGS ...

1 answers | 23 mins ago by ipa on Stack Overflow stackoverflow.com
1 answer

Vector iterator not dereferencable while implementing quicksort

I know there are several posts on this problem but I can't seem to fully understand the causes (I'm still a newbie in C++, 3 months experience) What I'm trying to do is implementing quicksort on a ...

1 answers | 29 mins ago by Gia Phat Ha on Stack Overflow stackoverflow.com
2 answers

Is there a way to simplify this C++ integer loop array?

This is an array that I've been learning to make in C++. Is there any way that I would be able to simplify this further? cout << "Array of integer values" << endl; cout ...

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

perform binary trees search based a collection of data

i was asked to write a BTS code for a collection of data with have the x, y and z coordinate, which has negative and positive number, and the requirement are below: That program is capable to ...

0 answers

Password Validation With C++ and Qt

I am building a password validation program in Qt with C++, but I'm running into some issues making it work properly with Qt. Apparently Qt doesn't use the isalpha function, so I'm not able to tell ...

2 answers

Iterator for a subset of a vector

Is it possible to get a const iterator from a vector that can only iterate a certain range of the vector before being invalidated? For example if I have a vector of 10 elements, I want to return an ...

2 answers | 1 hour ago by KaiserJohaan on Stack Overflow stackoverflow.com
0 answers

Android OpenCV - Converting OpenCV C++ Code to Android in order to detect QR Code Alignment Squares

Good day. I am building an Android Application where I'm aiming to scan a form using OpenCV for Android. I am planning to use the same concept that QR Codes use, the alignment squares, in order to ...

2 answers

Highlight text that matches a search string in Qt5

First let me explain what I'm trying to achieve: In your browser, hit Ctrl + f and type "q". The result of that operation is what I'm trying to achieve. It seems like this should be a solved problem, ...

2 answers | 1 hour ago by Josh Sanders on Stack Overflow stackoverflow.com
1 answer

C++ : Deleting records from binary file

I have the following class declaration: class student { int roll,marks; public: void input() { cout<<"Roll:";cin>>roll; ...

1 answers | 1 hour ago by Mohit Bhasi on Stack Overflow stackoverflow.com
4 answers

a valid program being declared as invalid by man7.org

In the manual about functions of buffer-using given at http://man7.org/linux/man-pages/man3/setbuf.3.html, a piece of code below is declared as invalid. However, when I try that on my machine, things ...

4 answers | 1 hour ago by walkerlala on Stack Overflow stackoverflow.com
0 answers

glDrawElements and Texture Coordinate

I just move on from Immediate Mode and try Vertex Array method using glDrawElements and I got the texture is mess. How to draw the texture correctly? This is a piece of my render code ...

3 answers

Static int with array C++

I'm trying to static count my driver user. however it always give me same value instead class Driver { private: static int ID; string name; public : void displayDriver(string n) { cout ...

3 answers | 1 hour ago by Natalie Ng on Stack Overflow stackoverflow.com
1 answer

Practical Cost of Uncontended Thread Locks

For a start, I should place emphasis on _completely uncontended_ thread locks in this subject. I'm well-aware of the very large cost of threads entering highly contended locks, being blocked and ...

3 answers

Converting bits of a byte to single bits and back

I have the struct below typedef struct fpButtons { /** BYTE 0 **/ uint8_t button_1:1; uint8_t button_2:1; uint8_t button_3:1; uint8_t ...

0 answers

how to write data to file larger 2GB with fstream c++

I have searched a TON to find a way, using fstream or other methods, to write data for a large file, but have not found any answers. My problem is, i'm download data from the internet and then ...

2 answers

Most vexing parse C++11

I'm confused about Y y {X{}}; what exactly this line does and what is its connection to the most vexing parse. A brief explanation is appreciated: #include <iostream> struct X { X() { ...

2 answers | 2 hours ago by test program on Stack Overflow stackoverflow.com
0 answers

How to output a certain piece of an array using a variable C++

I want to have an array output a certain piece of the array depending on what a randomly generated variable is. I want to have a karate-based simulator that reads what the opponent's kick is (1, 2, ...

3 answers

Compiler optimization or my misunderstanding

Recently I was testing some C++ deep and dark corners and I got confused about one subtle point. My test is so simple actually: // problem 1 // no any constructor call, g++ acts as a function ...

2 answers

Undefined Reference to Constructor with Arrays

I'm relatively new in this forum and to object oriented language so please forgive me if this seems kinda stupid. I just want to test calling a function, specifically a constructor, with arrays as ...

1 answer

Error: cannot deduce 'auto' type (initializer required)

When I compiled the project using g++ it is working, but when it comes to visual studio it shows an error Error: cannot deduce 'auto' type (initializer required) Code: void Student::eat() { // ...

1 answers | 2 hours ago by airsoftFreak on Stack Overflow stackoverflow.com
3 answers

c++ cannot convert 'double' to 'double*' for argument 1 to 'void sort(doubel*,int)' error

I'm a student listening to c programming lesson, and I'm using c++ to 'call-by-reference'. I don't know how to use c++ exactly, so I use c and save it into .cpp file. Anyway, I used a function to sort ...

3 answers | 2 hours ago by Inkyu Lee on Stack Overflow stackoverflow.com
3 answers

Why we flush a stream but not a buffer?

I know this is gonna be quite a stupid question, but after reading so many document about the whole "buffer" system, I can't understand why would people flush a stream but not a buffer. I have seen ...

3 answers | 2 hours ago by walkerlala on Stack Overflow stackoverflow.com
1 answer

Considering complexity of STL container operations

Do we factor-in the time/space complexities of STL container operations when calculating the complexity of an algorithm? For example, given the following code snippet: // str is an std::string, and ...

1 answers | 2 hours ago by AarCee on Stack Overflow stackoverflow.com
0 answers

JCS_RGBA_8888 not working in libjpeg

I am using libjpeg-turbo library in JNI using Android. I am getting pixel data from openGL glReadPixels in Android section and passing that data to JNI. My JAVA code is: IntBuffer ib = ...

1 answer

the default contents in the buffer of a stream

I have a little confused about the result of two slightly different piece of code like this: FILE* file=fopen("test.txt","w"); char buffer[6]="hello"; char arr[6]="haloo"; //setbuf(file,buffer); ...

1 answers | 3 hours ago by walkerlala on Stack Overflow stackoverflow.com
1 answer

How do I pass a LPCSTR to a c++ function convert to string and return a LPCSTR?

I have a C++ API function that is called by Install Shield via InstallScript: SQLHELPER_API LPCSTR GetAvailableAppName(LPCSTR appNameP) { //return "this works just fine"; std::string ...

15 30 50 per page
1 2 3