473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help: Problem with SDL code

The code: http://pastebin.ca/481492

I'm having a problem in line 128. Right as the sprite class
constructor begins. The compiler spits this at me:
"Return type specification for constructor invalid
New types may not be defined in a return type"

******************
class sprite
{
private:
int x, y, xvel, yvel, phase; //Determines sprite position
offsets and velocity

public:
sprite(); //Constructor
void handle_input();
void move ();
void show ();
}

sprite::sprite()
{
//Initialize offsets and velocity
x = 25;
y = 385;
xvel = 0;
yvel = 0;
phase = 0;
}
*********************
As you can see I'm not defining anything. I have no idea whats wrong
here, the problem must be somewhere else in the code? I'm lost here.

Yes, there are other errors but I need to get past this one first and
yes the code is not quite complete but still, what the hell is up with
this one?

May 10 '07 #1
5 1499
could the problem lie in line 12?

SDL_Surface * sprite = NULL;

--Michael
May 10 '07 #2
SpiralCorp wrote:
The code: http://pastebin.ca/481492

I'm having a problem in line 128. Right as the sprite class
constructor begins. The compiler spits this at me:
"Return type specification for constructor invalid
New types may not be defined in a return type"

******************
class sprite
{
private:
int x, y, xvel, yvel, phase; //Determines sprite position
offsets and velocity

public:
sprite(); //Constructor
void handle_input();
void move ();
void show ();
}
You forgot the semicolon here.
>
sprite::sprite()
{
//Initialize offsets and velocity
x = 25;
y = 385;
xvel = 0;
yvel = 0;
phase = 0;
}
*********************
As you can see I'm not defining anything. I have no idea whats wrong
here, the problem must be somewhere else in the code? I'm lost here.

Yes, there are other errors but I need to get past this one first and
yes the code is not quite complete but still, what the hell is up with
this one?
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May 10 '07 #3
On 10 mayo, 17:28, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
SpiralCorp wrote:
The code:http://pastebin.ca/481492
I'm having a problem in line 128. Right as the sprite class
constructor begins. The compiler spits this at me:
"Return type specification for constructor invalid
New types may not be defined in a return type"
******************
class sprite
{
private:
int x, y, xvel, yvel, phase; //Determines sprite position
offsets and velocity
public:
sprite(); //Constructor
void handle_input();
void move ();
void show ();
}

You forgot the semicolon here.


sprite::sprite()
{
//Initialize offsets and velocity
x = 25;
y = 385;
xvel = 0;
yvel = 0;
phase = 0;
}
*********************
As you can see I'm not defining anything. I have no idea whats wrong
here, the problem must be somewhere else in the code? I'm lost here.
Yes, there are other errors but I need to get past this one first and
yes the code is not quite complete but still, what the hell is up with
this one?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Thanks, that cleared up the class issue. Now ofcourse, I have more
problems... and all escape me. I really hope the new ones aren't as
embarrasing >_>

Heres the new code: http://pastebin.ca/481617

Problem 1:
Line 166 expected primary-expression before ',' token

Problem 2:
Line 206 expected `;' before "guysprite"

Ideas? =/

Thanks for the help, guys.

May 10 '07 #4
SpiralCorp wrote:
[..]
Thanks, that cleared up the class issue. Now ofcourse, I have more
problems... and all escape me. I really hope the new ones aren't as
embarrasing >_>

Heres the new code: http://pastebin.ca/481617

Problem 1:
Line 166 expected primary-expression before ',' token
You're trying to call a function. What's the third argument? What
did you intend it to be?
Problem 2:
Line 206 expected `;' before "guysprite"
Apparently it doesn't accept 'sprite' as a type-id. Perhaps it got
confused earlier.
Ideas? =/
None, really.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May 11 '07 #5
On 10 mayo, 22:10, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
SpiralCorp wrote:
[..]
Thanks, that cleared up the class issue. Now ofcourse, I have more
problems... and all escape me. I really hope the new ones aren't as
embarrasing >_>
Heres the new code:http://pastebin.ca/481617
Problem 1:
Line 166 expected primary-expression before ',' token

You're trying to call a function. What's the third argument? What
did you intend it to be?
Problem 2:
Line 206 expected `;' before "guysprite"

Apparently it doesn't accept 'sprite' as a type-id. Perhaps it got
confused earlier.
Ideas? =/

None, really.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Well, I figured it out a while ago. Forgot to check back here. Turns
out the compiler took issue with me using "sprite" as both a class AND
a surface variable. Thats what I get for recycling code. I've
restarted the whole thing, maybe I'll be back here with more newbie
mistakes in the near future =/

May 12 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: PHPkemon | last post by:
Hi there, A few weeks ago I made a post and got an answer which seemed very logical. Here's part of the post: PHPkemon wrote: > I think I've figured out how to do the main things like...
7
by: Christian Christmann | last post by:
Hi, in the past I always appreciated your help and hope that you also can help me this time. I've spent many many hours but still can't solve the problem by myself and you are my last hope. ...
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
6
by: Mark Reed | last post by:
Hi all, I am trying to learn a little about programming (I know next to nothing so far) and have found some code which hides the toolbars. However, this bit of code is a little too effective and...
4
by: dixie | last post by:
Help, I'm really out of my depth here (not unusual I hear you say :-). I have just installed HTML Help in an application. I told it in the Project Properties the path to the help file. I then...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
16
by: Allen | last post by:
I have a class that returns an arraylist. How do I fill a list box from what is returned? It returns customers which is a arraylist but I cant seem to get the stuff to fill a list box. I just...
3
by: inkexit | last post by:
I need help figuring out what is wrong with my code. I posted here a few weeks ago with some code about creating self similar melodies in music. The coding style I'm being taught is apparently a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.