Help, redeclaration not allowed

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
mrblob22
Posts: 2
Joined: July 21st, 2012, 2:28 am

Help, redeclaration not allowed

Post by mrblob22 » July 21st, 2012, 2:34 am

Hi, im on lesson 11 and when i build it this problem comes up...

1>..\Assets\D3DGraphics.cpp(76): error C2761: 'void D3DGraphics::Drawline(int,int,int,int,int)' : member function redeclaration not allowed
1>..\Assets\D3DGraphics.cpp(78): error C2447: '{' : missing function header (old-style formal list?)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========

Here are the codes i wrote

.ccp file
void D3DGraphics::Drawline( int x1, int x2, int y1, int y2, int, int g, int b1 );

{

int dx = x2 - x1;
int dy = y2 - y2;
int m = dy / dx
int b = y1 - m*x1;
for( int x = x1; x <= x2; x++ )

{
int y = m*x + b;
PutPixel( x, y, r, g, b1 )
}


}

.h file
void Drawline( int x, int y, int r, int g, int b1 );

idk if the lines have anything to do with the problem but could someone help?

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Help, redeclaration not allowed

Post by cameron » July 21st, 2012, 4:41 am

Hehe you made a few mistakes in your code.You said: void D3DGraphics::Drawline(int,int,int,int,int):.
Should be:void D3DGraphics::Drawline(int x1,int y1,int x2, int y2, int r, int g, int bl)
{

}
Also you said:void D3DGraphics::Drawline( int x1, int x2, int y1, int y2, int, int g, int b1 );
It should be: void D3DGraphics::Drawline( int x1, int x2, int y1, int y2, int r, int g, int bl );
{

}

Also you said: .h file
void Drawline( int x, int y, int r, int g, int b1 );
Should be:void Drawline( int x1,int y1, int x2, int y2,int r, int g, int bl);
Where did you get 2 .h file lines and 2 .cpp lines.Thats most the errors but there might be more in your other code not posted. :D







________________________________

cameron
Last edited by cameron on July 21st, 2012, 3:58 pm, edited 1 time in total.
Computer too slow? Consider running a VM on your toaster.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Help, redeclaration not allowed

Post by chili » July 21st, 2012, 6:51 am

mrblob22 wrote: Here are the codes i wrote

.ccp file
void D3DGraphics::Drawline( int x1, int x2, int y1, int y2, int, int g, int b1 );
You need to lose the semicolon here.
Chili

mrblob22
Posts: 2
Joined: July 21st, 2012, 2:28 am

Re: Help, redeclaration not allowed

Post by mrblob22 » July 21st, 2012, 4:15 pm

Alright thanks fixed it. seeing what the problem was lead to mutiple face palms.

Post Reply