C++ :: Debugger Crashes When Break Point Is Inside A Function

Aug 4, 2013

So, I have this code:

...
MakeTexture((char*)ilGetData(), ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT));
...

And it compiles fine and, supposedly, works fine too, but when I try to put a break point inside the MakeTexture fuction gdb just goes crazy, it freezes and starts alocating memory until it reaches like 30+ mbs, and after that codeblocks freezes and I have to terminate the gdb process to return everything back to normal.

Now, another weird thing is that this only happens if I pass (char*)ilGetData(), if I pass something like NULL to the function, this doesn't happen.

Oh, also, the MakeTexture function is this:

int MakeTexture(char *pxData, unsigned w, unsigned h)
{
return 0;
}

View 2 Replies


ADVERTISEMENT

C/C++ :: How To Tell If Point Is Inside Triangle Or Outside

May 13, 2014

So, I have created a class called "point" and i have 4 "point" objects. They only have 2 variables, x and y (their position). The first 3 points form a triangle and now I need to tell if the forth one is inside or outside. I have found some solutions but they involve heavy math (they are based on the sum of the angles or something like that). I want to know if there is any way to solve this only by using the distance between points. I have created a function which takes 2 "point" objects and returns a float value which is their distance.

Here is some code:

#include <iostream>
#include <cstdlib>
#include <math.h>
using namespace std;

[Code]....

View 5 Replies View Related

C/C++ :: Using A Point Inside Vector?

May 12, 2014

I am trying to write a basic editor program and one of the parts asks me to "process dot commands that move point in whole line increments"

Earlier it says that a point is interpreted as specifying the location between characters rather than the characters themselves. and i need to use this to implements the following:

< moves point to the beginning of the document. > moves point to the end of the document. p moves point to the beginning of the previous line. n moves point to the beginning of the next line. k deletes the current line and leaves point at the beginning of the following line.

(there was a previous part before this so i already have some code that works) and in this part I'm trying to do a switch case

ie

for
< , >, p , n and k

I guess my question is how do i make this "point" need. Ive been using vectors, so the point needs to be somewhere inside the vector. I don't think ill be able to do what i need to do with out the point.

View 14 Replies View Related

C/C++ :: Finding Whether Point Is Inside Polygon

Jul 17, 2012

I am trying to find out whether a point is inside a polygon.I am using vector std c++.

My program till now:

Polygon.h
class Polygon {
public:
Polygon();
virtual ~Polygon();
virtual bool Inside(Point p);

[Code] ....

I liked the ray casting algorithm but I dont know how to do in C++.

View 28 Replies View Related

C++ :: Mathematically Check For 3D Point Inside Volume?

May 3, 2013

In 2D I checked to see if a point was inside a shape by creating triangles between 2 neighbouring points and the centre of the object, then checking the angle to the 3 points from the test point and if the sum = 360... If not then it isn't inside the triangle. But how would I check if a point is inside a volume rather than an area? I know the same method would work but I don't think very well as it'll be testing with the thickness of the shell of the 3D object, which may be quite easily jumped in a single frame of movement..

View 8 Replies View Related

C++ :: Using Break In Void Function That Does Not Contain A Loop

Jan 14, 2015

I need this break in my main function, but I'm not allowed to put it in void since void is not located in a loop. How can I solve this?

Code:
#include <iostream>#include <string>
using namespace std;
void login(string x, string y);
string username;
string password;
string x;
string y;

[Code] ....

View 6 Replies View Related

C :: 1D Dynamic Array Crashes When Read From File Into A Function

Mar 17, 2014

code:

/part of main function
int *A=NULL;
//load from file
load_from_file(A, &next);
printf("next=%d
",next);
getchar();
printf("A[%d]=%d
",0,A[0]);getchar();//here program crashes
}

[code]....

I initialize array A with NULL in main, and I "load" it with elements from a file. The code without function is working. But when I tried to use a function as above, my array crashes!!!

View 4 Replies View Related

C++ :: Using Template Function Inside Class In Separate Function?

Mar 26, 2014

i want to use a class to print data stored as vector or array with different data types. i also want the print function two take more than one vector or array or combination of both so that they can be written to file as two columns. so i wrote the following class:

right now it has only one member function for printing two vectors. later i'll add additional functions as required.

note: there has to be template functions inside the class
i also want the object to be global so that i need not pass it as an argument to other calling functions

class printdata
{
public:
template<typename T1,typename T2>
void SaveData( vector<T1> &data1,vector<T2> &data2, std::string var)
{

[Code]....

then i want to call this template function in another ordinary function written in a seperate cpp file

these function declarations are put in a header file. so i need know whether i should put the declaration of the template function in the header to use the function in different functions

View 4 Replies View Related

C/C++ :: Using Template Function Inside A Class In Separate Function?

Mar 26, 2014

i want to use a class to print data stored as vector or array with different data types.

i also want the print function two take more than one vector or array or combination of both so that they can be written to file as two columns.so i wrote the following class:

right now it has only one member function for printing two vectors. later i'll add additional functions as required.

note: there has to be template functions inside the class / i also want the object to be global so that i need not pass it as an argument to other calling functions

class printdata {
public:
template<typename T1,typename T2>
void SaveData( vector<T1> &data1,vector<T2> &data2, std::string var){
std::ofstream myfile;
std::string filename;

[code].....

then i want to call this template function in another ordinary function written in a seperate cpp file these function declarations are put in a header file. so i need know whether i should put the declaration of the template function in the header to use the function in different functions.

View 1 Replies View Related

C++ :: SDL Won't Detect Debugger

Sep 2, 2013

Current compiler doesn't have correctly defined debugger!

ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

Create new parser for project 'Test'

Project 'Test' parsing stage done!

View 4 Replies View Related

C++ :: Watch Elements Of A List In Debugger?

May 11, 2014

How can i look into the element that are pushed into the list. Something like listPointer[0].heapPointer,50

class CA{
public:
CA(void);

[Code].....

View 3 Replies View Related

Visual C++ :: How To Use A Different File For The Source In The Debugger

Nov 3, 2013

Visual studio 2012

I have a project that has a few .asm files (assembly language code), I have the compiler/assembler set to create a list file for the assembly code and would like the debugger to use the .lst file for the source instead of the .asm files because in the .asm files the macros are not expanded like they are in the .lst files which makes debugging difficult sometimes.

View 1 Replies View Related

C :: Point Of Function Pointers

Sep 27, 2014

I'm wondering about the point of pointers to functions. When is it used?I saw the below example. It doesn't make sense to me. I mean we can easily write code that does the same without having to use pointers.

Code:

#include <stdio.h>
int addInt(int a, int b); // Adds 2 integers
int add5to4(int (*function_pointer)(int, int));
int main(void)
{
int sum;
int (*function_pointer)(int, int);
}

[code]....

View 2 Replies View Related

C++ :: Way To Use Debugger To Log Addresses Of Data It Allocated On Heap

Sep 19, 2014

I used a heap viewer to check for memory leaks. I have many of them and its hard to find out where it is not being freed. Is their a way to use the debugger to log the addresses of the data it allocated on the heap. This way I can trace it back. Or is their any other way to fix memory leaks properly.

View 4 Replies View Related

Visual C++ :: Can Create Graphical Extension For VS 6.0 Debugger

Feb 8, 2013

I'm digging an old project and i can't switch to a newer visual studio.

I want to plot float data array during debug.

I know some IDE's have such option. There is a separate window in which we can plot data.

Can I write such plugin for Visual Studio 6.0 using visual studio SDK?

Does it support 6.0 version?

View 1 Replies View Related

Visual C++ :: Program Runs ONLY If Debugger Is Attached

Mar 13, 2014

I have an interesting (and incredibly frustrating) problem where my application runs fine, but ONLY when a debugger is attached to it.

I can build in both Debug or Release and double clicking the execuable causes it to crash before the window is drawn. However if I launch from the IDE (VS2010), again in both Debug or Release mode, the application runs perfectly fine.

How to debug in this situation.

I am using VS2010 in Windows 7, C++ with MFC. This is an application which has been migrated from VC++ 6 to VS2010. Note, it works perfectly when built from VC++ 6.

View 8 Replies View Related

C++ :: Function To Return Floating Point Value

Oct 11, 2013

Function is not returning a decimal point value. Here is my function

int meanValueFunction(vector<int> arrayValues){
int sum = 0;
sum = sumFunction(arrayValues);
float meanValue = sum/arrayValues.size();
cout<< meanValue << endl;
return meanValue;

I want result in decimal point i.e 27.2 for the values (2 4 20 10 100) but it returns 27 instead.

View 2 Replies View Related

C :: How To Change MPI Broadcast Into Asynchronous Point To Point Communication

Jun 26, 2013

I have one code that use MPI broadcast and I want to change it into Asynchronous Point to Point communication. I am newbie in Parallel programming. Looking for implementation of one simple same program in broadcast and P2P ?

View 6 Replies View Related

C++ :: How To Break Up A Word

Mar 7, 2013

I was wondering if there is a way for me to break up a word compare it one character at a time and change it according to a real word like if you have cat and dog it would go from cat to bat, bat to bag, bag to bog, then bog to dog.

View 1 Replies View Related

Visual C++ :: Watch Window No Longer Shown In Debugger

May 23, 2013

Visual c++ 2010 Express

Somehow the watch window is no longer shown in the debugger. It used to be available and I am stopped at a breakpoint.

Is there a way to turn it back on or restore it?

View 4 Replies View Related

C++ :: Having A Function Inside For Each Statement

Dec 4, 2014

I keep on getting error message while trying to pass a function inside a for_each loop.. I have a vector and i used for_each loop to go through the rows in that vector, Now I need a function to do something

Example this is what I am trying to achieve

for_each (label.begin(), label.end(), addToTemporaryVector());
void DataPartitioning::addToTemporaryVector(){
cout<<"sucess";
}

But I get an error message saying: error: invalid use of void expression

View 2 Replies View Related

C :: Function To Find Starting Point For Recursive

Mar 6, 2015

I am trying to create a function to find the entry point of my map.But my program does not seem to be working correctly. I am trying to place a dot there because I will have to use recursion to fill up the whole map. But I'm not asking for the answer. I just need writing a function to locate the starting row for the first column of the maze (first non zero element). My code seems to have a bug in it when I try and call my function FindEntry. What I am trying to do is read in column by column until I can find the starting point and then place a dot there with ASCII character 249. This is my code so far:

Code:
#include<stdio.h>
#include<Windows.h>
#define HEIGHT 21
#define WIDTH 78

[Code]....

If you try and run it, it will give you a bug. But if you comment out the FindEntry function in the main it will work and look like this:

View 7 Replies View Related

C/C++ :: How To Use Alphabets To Break Do While Loop

Jul 29, 2014

#include<iostream>
using namespace std;
int main() {
int choice[10] = { 0 };
int vote, highvote;
cout << "1 Lional Messi ";

[code]....

My problem is i have to stop the loop when i enter any alphabets, i tried a lot of method but still doesn't work.

View 5 Replies View Related

C++ :: Function Pointers Inside Array

Apr 6, 2014

Ive recently got into function pointers, i find that they can be quite handy for making your program very 'dynamic'.

However, the syntax is very confusing for what i want to do
This is what i want to do

I want to hold function pointers inside an array, but this array is dynamically allocated ( malloc, realloc, etc )

This is the current syntax ive come up with, but i dont think it is correct

void ( **drawFunc ) ( void*, SDL_Surface* );

View 2 Replies View Related

C++ :: Dealing With 2D Array Inside A Function

Apr 16, 2014

I have a problem with pointer array, i passed a 2d array to a function but then i dont know how to make operations on it !!!

#include <iostream>
using namespace std;
int fun_name (int * arr) {
for (int i = 0;i< ??? ;i++) // how to compare while i don't know the size of array!!

[Code] ....

View 2 Replies View Related

C/C++ :: Modifying Array Inside Of Function

Mar 7, 2014

I am new to C++ and am trying to modify an array inside of a function.

It is of my understanding that you cannot return an array from a function?

Would writing it to a data file and then retrieving it be a solution to this problem?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved