Segmentation Fault

Discussion in 'C++' started by Amar Prakash Tripaithi, Dec 4, 2005.

  1. 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
     
    Amar Prakash Tripaithi, Dec 4, 2005
    #1
    1. Advertising

  2. Amar Prakash Tripaithi

    Artie Gold Guest

    Amar Prakash Tripaithi wrote:
    > 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


    --
    Artie Gold -- Austin, Texas
    http://goldsays.blogspot.com
    http://www.cafepress.com/goldsays
    "If you have nothing to hide, you're not trying!"
     
    Artie Gold, Dec 4, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley
    Replies:
    17
    Views:
    869
  2. Pud
    Replies:
    0
    Views:
    578
  3. Replies:
    0
    Views:
    530
  4. Ivan Vecerina
    Replies:
    0
    Views:
    487
    Ivan Vecerina
    Jun 29, 2003
  5. Vasileios Zografos

    Re: segmentation fault exception handling

    Vasileios Zografos, Jun 30, 2003, in forum: C++
    Replies:
    5
    Views:
    15,621
    Pete Becker
    Jul 1, 2003
Loading...

Share This Page