Archived

This topic is now archived and is closed to further replies.

God save my delusional compiler...

This topic is 5506 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

please don''t flame me... please... Can anyone identify what forms of LSD my computer has been ingesting? cSky.h
  
class cSky
{
	public:
		cSky();
		virtual ~cSky();

		virtual bool Render();

	private:

};

class cSkyBox : public cSky
{
	public:
		cSkyBox();
		virtual ~cSkyBox();
		
		virtual bool Render();

	private:

};

class cSkyDome : public cSky
{
	public:
		cSkyDome();
		virtual ~cSkyDome();
		
		virtual bool Render();

	private:

}
  
cSky.cpp
  
cSky::cSky()
{

}

cSky::~cSky()
{

}

cSkyBox::cSkyBox()
{

}

cSkyBox::~cSkyBox()
{

}
  
cSky.cpp(13) : error C2533: ''cSky::cSky'' : constructors not allowed a return type cSky.cpp(23) : error C2264: ''cSky::cSky'' : error in function definition or declaration; function not called Thanks ~Vendayan

Share this post


Link to post
Share on other sites
Thanks SmartIdiot and DrPizza, although I still dont see why my compiler would take that as my constructor trying to return a value. So I blame my compiler''s addiction to LSD and not my own incompetence.

~Vendayan

Share this post


Link to post
Share on other sites
quote:
Original post by Vendayan
Thanks SmartIdiot and DrPizza, although I still dont see why my compiler would take that as my constructor trying to return a value. So I blame my compiler''s addiction to LSD and not my own incompetence.

The class definition hasn''t been terminated, so the compiler continues eating symbols and parses a ctor definition. It puts 2 and 2 together and figures out the class must be the return type for the ctor, which is the first diagnosable error it encounters.

Share this post


Link to post
Share on other sites
The reason you need a semicolon at the end is because you declare objects at the end of the class (especially if it's a nameless class)

Your compiler gave that rather strange error because it saw the constructor right after it, and assumed you were trying to return an instance of type cSkyDome.

edit:

As SabreMan was saying before I rudely interupted him

[edited by - smart_idiot on November 20, 2002 12:54:03 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Vendayan
So I blame my compiler''s addiction to LSD and not my own incompetence.
~Vendayan


yes, they''ve yet to invent the "do as i want, not as i say" compiler.

Share this post


Link to post
Share on other sites