Results 1 to 4 of 4

Thread: struct problem...

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Posts
    47
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question struct problem...

    I just want to try to use struct for my further usage.
    In the header file I define a struct:
    struct refer{
    double Are;
    double Ere;
    };

    class newstruct{
    public:
    newstruct();
    struct refer refer1;
    struct refer1 a(double b,double c);
    };
    In the .cpp file:
    struct refer1 newstruct::a(double b,double c){
    refer1.Are=b;

    refer1.Ere=c;
    cout<<refer1.Aref<<endl
    <<refer1.Eref<<endl;

    return(refer1);
    }
    the error:
    NewStruct.cpp: In member function `refer1 newstruct::a(double, double)':
    NewStruct.cpp:7: error: return type `struct refer1' is incomplete
    NewStruct.cpp:12: error: conversion from `refer' to non-scalar type `refer1' requested
    Can anyone tell me the problem?Thank you very much!
    Best Regards!
    Last edited by hiuao; 5th April 2007 at 06:08.

Similar Threads

  1. Replies: 16
    Last Post: 23rd May 2008, 10:12
  2. Problem porting Kivio MP on win32 from Qt 3 to Qt 4
    By Amanda in forum Qt Programming
    Replies: 2
    Last Post: 26th October 2006, 19:40
  3. problem with saving QCstrings
    By nass in forum Qt Programming
    Replies: 3
    Last Post: 5th October 2006, 15:12
  4. Replies: 16
    Last Post: 7th March 2006, 15:57
  5. Problem with pointers while using localtime() and time()
    By jamadagni in forum General Programming
    Replies: 7
    Last Post: 11th January 2006, 15:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.