help me in this!!!!

This is a discussion on help me in this!!!! within the C++ Programming forums, part of the General Programming Boards category; hi can anyone solve this errors? code Code: class defGeomtry:public defFile{ public: std::map<std::string, tag_t> objectNameTag; void populateGeometry(void); static tag_t createSplineThruPoints(struct ...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    78

    help me in this!!!!

    hi can anyone solve this errors?

    code
    Code:
    class defGeomtry:public defFile{
    public:
    
    	std::map<std::string, tag_t> objectNameTag;
    
    	void populateGeometry(void);
    
    	static tag_t createSplineThruPoints(struct Section);
    
    	static struct SectionformSection(struct Section Section1,struct Section Section2);
    	
    	static struct SectionxtractPoints(struct Section Section1,int FromPoint, int ToPoint);
    
    };

    errrors:




    1>d:\backup_qi-287\geconfidential\rajesh\hitachi_runner_blade\cod e_runner_blade\runner_blde\runner_blde\defgeometry .h(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>d:\backup_qi-287\geconfidential\rajesh\hitachi_runner_blade\cod e_runner_blade\runner_blde\runner_blde\defgeometry .h(38) : warning C4183: 'SectionformSection': missing return type; assumed to be a member function returning 'int'
    1>d:\backup_qi-287\geconfidential\rajesh\hitachi_runner_blade\cod e_runner_blade\runner_blde\runner_blde\defgeometry .h(40) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\backup_qi-287\geconfidential\rajesh\hitachi_runner_blade\cod e_runner_blade\runner_blde\runner_blde\defgeometry .h(40) : warning C4183: 'SectionxtractPoints': missing return type; assumed to be a member function returning 'int'

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Did you read the reply I posted to another of your similar questions?

    Code:
    static struct SectionxtractPoints(struct Section Section1,int FromPoint, int ToPoint);
    You are saying that you want to return a struct from a function, but not WHAT struct it is. This is like saying to a driver turn right on ... without telling them which road to turn right onto - no meaning in that.

    The other errors are most likely just consequential errors based on the compiler being "lost" after having tried to make a right turn without knowing quite where to turn right...

    Edit: This is your previous thread, with identical problem: whats wrong in this!!!!

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    78
    Thanks I Will Try It!

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    78
    can you please telll what strcture type means? isnt it is sufficient to just say struct?

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    No - in fact in C++ it's the other way around, the word struct is optional, but you NEED to give the name of the struct, e.g.
    Code:
    struct Section {
       // your stuff goes here  
    };
    
    Section someFunction(// some parameters) ;
    should work just fine.

    How is the compiler going to know WHICH of your potentially many structs that you want to use?

    Can I make a comment on your style as well:
    Code:
    	void populateGeometry(void);
    
    	static tag_t createSplineThruPoints(struct Section);
    
    	static struct SectionformSection(struct Section Section1,struct Section Section2);
    	
    	static struct SectionxtractPoints(struct Section Section1,int FromPoint, int ToPoint);
    Some of your functions begin with upper (blue) case, other functions start with lower case (red), and then you mix upper and lower case for the next words in the function name (green). I would also prefer correct spelling of "extract", rather than "xtract" - it's bound to confuse people with that sort of naming convention. Confused programmers make mistakes more often than those that are not confused. Consistancy reduces the chance of someone being confused.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Dec 2007
    Posts
    78
    thanks for all of your comments , i will follow it!!!

    but can you please give me syntax of function declaration which returns strcture?

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I just did, "SomeFunction" returns a struct of type Section.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    Registered User
    Join Date
    Dec 2007
    Posts
    78
    thanks!! but its not working!!!

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Sorry, I'm not a very good telepath - you will have to actually show the code you're working on and what the error message are [or whatever the symptoms of "it's not working" is].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #10
    Registered User
    Join Date
    Dec 2007
    Posts
    78
    hi this is the code, i have created object of strcture section as sec1 :
    code:

    Code:
    
    class defGeomtry:public defFile{
    public:
    	std::map<std::string, tag_t> objectNameTag;
    	void populateGeometry(void);
    	static tag_t createSplineThruPoints(struct Section);
    	static sec1 formSection(struct Section Section1,struct Section Section2);	
    };






    1>d:\backup_qi-287\geconfidential\rajesh\hitachi_runner_blade\cod e_runner_blade\runner_blde\runner_blde\defgeometry .h(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>d:\backup_qi-287\geconfidential\rajesh\hitachi_runner_blade\cod e_runner_blade\runner_blde\runner_blde\defgeometry .h(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\backup_qi-287\geconfidential\rajesh\hitachi_runner_blade\cod e_runner_blade\runner_blde\runner_blde\defgeometry .h(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

  11. #11
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by chintugavali View Post
    hi this is the code, i have created object of strcture section as sec1 :
    code:

    Code:
    
    class defGeomtry:public defFile{
    public:
    	std::map<std::string, tag_t> objectNameTag;
    	void populateGeometry(void);
    	static tag_t createSplineThruPoints(struct Section);
    	static sec1 formSection(struct Section Section1,struct Section Section2);	
    };
    What do you mean when you say that you have created an object of structure Section as sec1? Do you mean you have
    Code:
    Section sec1;
    somewhere? That makes sec1 a variable of type Section, but it does not make sec1 into a type.

    If you want to return a Section, return a Section:
    Code:
    static Section formSection(struct Section Section1, struct Section Section2);

  12. #12
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So where is your struct sec1 declaration?

    You have "struct Section" in the parameters, do you perhaps mean to use "Section" as the return type too, or is "sec1" a different struct?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  13. #13
    Registered User
    Join Date
    Dec 2007
    Posts
    78
    sec1 is declared in other headerfile...
    Code:
    struct Section{
    	char Name[256];
    	int NumberOfPoints;
    	std::vector <struct point> Points;
    }sec1,sec2;

  14. #14
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    But sec1 is a variable, not a structure. This is the same as saying
    Code:
    int x;
    
    x func(int z)
    {
    }
    Guess what, that won't work!

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  15. #15
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by chintugavali View Post
    sec1 is declared in other headerfile...
    Code:
    struct Section{
    	char Name[256];
    	int NumberOfPoints;
    	std::vector <struct point> Points;
    }sec1,sec2;
    Right, so that makes sec1 a variable, not a type. You wouldn't do
    Code:
    int i;
    i addThings(int a, int b);
    would you? You would declare addThings as returning an int (a type, not a variable).

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21