c++,arraysView the original page-Collection of common programming errors

UnKnown Error


  • Mike
    c++ stl nfa automaton 2013-12-18 12:51:27
    For some days I’m trying to do a program for simulate a nondeterministic finite automaton (NFA), more specifically, a string recognizer. After several failures, thanks to the user Konrad Rudolph, I could implement a solution based on this pseudocode:Well, in an NFA you have a set of current states, and in each step you go through all current states, and for each, you select all valid transitions. Those combined sets form your new state set.At the end, you check whether the intersection of the cu

  • biot023
    c++ 2013-12-18 12:50:56
    I have some code which I adapted (barely changing it) from the C++ Concurrency In Action book, so would have expected it to work — only it doesn’t. What I’ve tried to do is to implement a thread-safe queue that I can then store background jobs for a thread or threads in. The queue looks like this:queue.h#pragma once #include “imgproc/i_queue.h” #include <memory> #include <thread> #include <queue> #include <mutex> #include <condition_variable>using namespace std;nam

  • Thalia
    c++ opencv colors 2013-12-18 12:48:17
    I am trying to troubleshoot a project that uses openCV. Somewhere, there is a histogram equalization – that crashes when the input image is pure black (or pure white or pure something).I have been trying to troubleshoot the debug assertion failure that I get – “Expression: vector subscript out of range” – unsuccessfully. Note: the method does not use EqualizeHistogram, it creates the histogram manually, counts pixels per level, does an average – like in the textbook. If I can isolate the case wh

  • mag_zbc
    c++ winapi 2013-12-18 12:42:26
    My problem is that sometimes, when closing the game, one of two may occur:Process stays in memory and it have to be killed manually Game crashesI’m not sure if those two are related or completely independent issues. Both of those happen very rarely, but I have to eliminate these situations.As for the crash, I made a dump and it says that the crash occurs in PeekMessage() function. The code looks like this:bool running = true;/// Reset timer Timer.Reset();MSG msg; ZeroMemory(&msg, sizeof(msg)

  • user575883
    c++ linux gdb coredump 2013-12-18 12:28:24
    Is possible to recover the exact values of argv and argc parameters of a main after the application crashed?I need to use only the application core-dump and gdb debugger on Linux.

  • sth
    c++ 2013-12-18 12:22:23
    When,i try to assign null value to my pointer,it sometimes crashes on that line. The code is something like this :if(s_counter != NULL) {delete s_counter;s_counter = NULL; // it sometimes crashes here. }This is not reproducable,100%,but it occurs frequently. Can anybody help in this?

  • benwad
    c++ osx fullscreen lldb 2013-12-18 12:09:58
    I’m trying to debug a crash in a full-screen Mac game I’m working on, but when I have LLDB attached it just causes the game to freeze when the crash happens, and I can’t get away from the game – I need to do a hard reset on the computer. Is there any kind of tool or preference for doing this? The computer I’m using to reproduce the crash doesn’t have multiple monitors.

  • S BI
    c++ winapi windows-7 2013-12-18 12:05:55
    I have a program that launches a child process. When the child process crashes I would like there not to be a debug message box. I would like to do this without writing anything in the child process.I am running this on windows 7.In the createProcess function, in the flags parameter I only put CREATE_NEW_CONSOLE.During my attempts, I put SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX) in the child process and made it crash, there was no dialog box. Now I put the same function call in

  • Daniel
    c++ visual-c++ linker mingw libx264 2013-12-18 12:00:00
    I’m working on a C++ project using Visual Studio 2010 on Windows. I’m linking dynamically against x264 which I built myself as a shared library using MinGW following the guide athttp://www.ayobamiadewole.com/Blog/Others/x264compilation.aspxThe strange thing is that my x264 code is working perfectly sometimes. Then when I change some line of code (or even change the comments in the file!) and recompile everything crashes on the lineencoder_ = x264_encoder_open(&param);With the messageAccess v

  • theAlse
    c++ gdb 2013-12-18 11:32:23
    I am trying to figure out a way to run an executable with GDB repeatedly and preferably halt on errors.I could not find a way to do this in the manual!Thanks

  • Ertain
    java android xml arrays button 2013-12-18 11:26:59
    [Edit] When I try Sumant’s suggestion of switching out “v.getContext()” with “this” in the Intent constructor Eclipse says it can’t build the app. When the onClick() method is called isn’t the current View passed to it?[Edit 2] I may have figured out the problem. It could have been that I was using a layout meant for Android 3.0 when I was using an Android 2.3.3 emulator. It was either that, or my just using a string array rather than an integer array.In my Android app when a user clicks on a

  • King_Knight
    c++ arrays opencv for-loop variable-assignment 2013-12-18 4:23:43
    I’ve posted a similar question to here: why it crashes when assigning new values to arrays?But this time, I encountered another problem with arrays again. My code is like this: double diff[600][800][3]; cv::Mat value ( height, width, CV_8UC3 ); double mean[600][800][3]; …. for ( int i =0; i < 5; ++ i ) {for ( int j = 0; j < 3; ++j ){for ( int m = 0; m < 2; ++m ){mean[i][j][m] = 10/m;diff[i][j][m] = abs ( value.data[value.cols*i+j]-mean[i][j][m]);}} }It crashed at the line:diff[i][j][m

  • quartaela
    c arrays mergesort 2013-12-18 0:48:19
    Possible Duplicate:Big array gives segmentation error in C i’m trying to compare merge sort and quick sort with different input sizes like 10.000, 100.000, and 1.000.000. However, when i give one million input size program is crashing and i don’t know why ?.On the other hand, array is filled with reading from a file which contains numbers and here is my simple merge sort.#include <stdio.h> #include <stdlib.h> #include <sys/time.h>#define SIZE 1000000void Merge(int * , int , in

  • WillBD
    c++ arrays memory 2013-12-17 19:51:33
    First off, i’ll say thank you in advance for any help you can give. I know this is my first post, and it’s going to be a little dense, so I’ll apologize for that straightaway. Here goes. So this program is supposed to be a sort of dumb database that uses a hash-table for storing a ‘person’ struct that is constructed from a file. Each ‘person’ in the database has a certain number of hours volunteered, and based on how many hours they volunteered, they owe a certain amount of money. (more voluntee

  • Quaker
    c arrays memory-management allocation 2013-12-17 19:46:56
    My program crashes on this function on the 7th line, when I call malloc() when I run in release mode I get the `Program.exe has stopped working message, and when I run in debugger, most of the time it succeeds but sometimes I get this message (especially on larger input):MONOM* polynomialsProduct(MONOM* poly1, int size1, MONOM* poly2, int size2, int* productSize) {int i1, i2;int phSize = 1, logSize = 0;MONOM* product;product = (MONOM*)malloc(phSize*sizeof(MONOM));monomAllocationVerification(prod

  • kd7vdb
    c++ arrays infile 2013-12-17 18:01:00
    For some reason or another I cannot figure out why the data when opened does not get put into arrays and the program crashes. I have searched around for a answer to no avail. I get the feeling I will be posting a here a few more times before I finish this program! #include <iostream> #include <string> #include <fstream> using namespace std; string bookTitle [14]; string bookAuthor [14]; int loadData (string pathname); void showall (int counter);int mai

  • user2829022
    arrays node.js asynchronous logic 2013-12-17 15:36:14
    I’ve got a crash happening on my node server and I can’t figure out how it could logically happen. I haven’t personally repro’d but its happened a few times in the last week according to bugsnag. Any thoughts on why it might be happening or suggestions for additional logging to help debug would be greatly appreciated.I’ve got a 2-player game, where each person is dealt a hand, and then needs to select two cards from their hand to discard. Discarding is done simultaneously, so players may discard

  • Mathieu C.
    arrays buffer vhdl xilinx 2013-12-17 12:39:13
    I am currently trying to create a screen buffer in VHDL (for a device that sends video data via VGA). I am using Xilinx ISE 13.1, and i am a begginer in VHDL.My idea was to create a large bidimensional array containing the RGB value of each pixel (on 8 bits).I can write in the array with no problem, but it becomes more complicated when I have to read it : The synthesis becomes extremely long, and XST just completely saturates the memory untill the computer shuts down by itself. Here is a simplif

  • nhahtdh
    objective-c ios arrays nsmutablearray nsarray 2013-12-17 9:52:26
    I’m making a code which shows the names of people on a list.The list is different for each date, so my problem is when there is only like 1 or no people signed and I make an array with index beyond the limit of people, it crashed. I know that this happens because the array is empty, but how do I make the code ignore empty arrays?I have tried to make an “if” that count the number of arrays and then decide to post the array or just post no name. But it doesn’t work like this, I still get the out o

  • Misiu
    arrays actionscript-3 flash-builder flash-cs5 2013-12-17 8:51:22
    I’m trying to build game like http://games.yahoo.com/game/bricks-breaking in actionscript 3 (flash builder). I am able to create an array of bricks (that are visible on game start), but I have no idea how to find a group of bricks in array.Lets say we have array like so:1 2 2 1 3 3 1 1 1 1 1 1 1 1 2 1 1 1 3 1 1 1 1 1 1 1 1 2 1 1 1 3 1 1 1 1 1 1 3 1 1 2 1 1 3 3 3 1 1 1 1 3 1 1 1 2 1 3 1 3 3 1 1 1 3 1 1 1 3 3 3 1 3 3 1 1 1 3 1 1 1 1 1 1 1 3 3 1 1 1 1 When the user clicks any brick colored re