SDLCharacter::SDLCharacter(SDLGraphics* graphics, int imgX, int imgY, int imgW, int imgH,
int TransparentRed, int TransparentBlue, int TransparentGreen,
string filename, float maxspeed, int posX, int posY, float angle)
{
m_graphics=graphics;
m_imgX=imgX;
m_imgY=imgY;
m_height=imgH;
m_width=imgW;
m_posX=posX;
m_posY=posY;
m_maxspd=maxspeed;
m_currentspdX=0;
m_currentspdY=0;
m_currentAngle=angle;
m_graphics->imageLoad(filename, TransparentRed, TransparentBlue, TransparentGreen);
m_image=m_graphics->screenReturn();
}
"new types may not be defined in a return type" error
I keep getting the error in the title on this code and i can't seem to figure out why. (The SDLGraphics class works ok because i have tested it separately.)
any ideas are apreciated :)
That error is typically caused by forgetting a semicolon at the end of a class / struct / union...
In Compile time (somewhat a stupid question)? What line does the error point to?
EDIT: Ow. Beat by two people in under a minute.
EDIT: Ow. Beat by two people in under a minute.
the error is in the title of the topic... and it's a compilation one.
it's weird because the ide (eclipse) shows me the error on the line where the paranthesis
( "{" ) starts, right after declaring the parameters.
it's weird because the ide (eclipse) shows me the error on the line where the paranthesis
( "{" ) starts, right after declaring the parameters.
Quote:Original post by Hypherion
the error is in the title of the topic... and it's a compilation one.
it's weird because the ide (eclipse) shows me the error on the line where the paranthesis
( "{" ) starts, right after declaring the parameters.
But what does it actually say? Missing semicolon? Unknown type? Something else?
You haven't specified a return type for your method in the implementation shown. What return type did you specify when declaring the method in the header?
EDIT: Nevermind, it's the constructor I see know ^^
"error: return type specification for constructor invalid" -> this is the other error i get and they both redirect me one to the other :| .
Quote:Original post by Hypherion
"error: return type specification for constructor invalid" -> this is the other error i get and they both redirect me one to the other :| .
Can you show us the code where you declare the constructor in the header?
Quote:Original post by rip-off
That error is typically caused by forgetting a semicolon at the end of a class / struct / union...
I think you'll find this is the answer. Try adding a semicolon to the end of your SDLCharacter class:
class SDLCharacter{public: SDLCharacter(...); void foo(); void bar();}; // <--- HERE
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement