Segmentation Fault

  • Thread starter Amar Prakash Tripaithi
  • Start date
A

Amar Prakash Tripaithi

Hi Friends,
I am working on a project of User Interface Class Library. In
it, I have to create a class library in "gnu" using c++ and curses
library. I am facing problem while I am on the way of organizing the
file.
Actually I had to create the header files. Now, when I
initialized the "WINDOW *win" in the Super class Window and destroy it
there using "endwin()" command, I am facing segmentation fault.
Beside this I had organized the common attributes of various
User Interfae controls into structure, take for example:
struct Position{
int Height;
int width;



}


Position *p={23,34};

// the struct is declared as global. and its default value declaration
is also global.


In the Label class, when I try to pass this value to the local variable

that too give me a segmentation fault,...


//code extract


class label
{
private:
Position *LoP;
public:
int default()
{
LoP=&P;
}



}


Can anyone please help me in getting out of this problem.

with regards


Amar Prakash Tripathi
 
A

Artie Gold

Amar said:
Hi Friends,
I am working on a project of User Interface Class Library. In
it, I have to create a class library in "gnu" using c++ and curses
library. I am facing problem while I am on the way of organizing the
file.
Actually I had to create the header files. Now, when I
initialized the "WINDOW *win" in the Super class Window and destroy it
there using "endwin()" command, I am facing segmentation fault.
Beside this I had organized the common attributes of various
User Interfae controls into structure, take for example:
struct Position{
int Height;
int width;



}


Position *p={23,34};

The above line makes no sense. `p' is a *pointer* to a struct, not a struct.
// the struct is declared as global. and its default value declaration
is also global.


In the Label class, when I try to pass this value to the local variable

that too give me a segmentation fault,...


//code extract


class label
{
private:
Position *LoP;
public:
int default()
{
LoP=&P; What is `P'?
}



}
In the future, post *real* code (either the smallest possible snippet
that exhibits the problem or, in the case of a compilation error the
smallest snippet you think *should* be compilable). What you've posted
does not give enough information to even *start* attempting to diagnose
the problem.

HTH,
--ag
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top