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?
Help, redeclaration not allowed
Re: Help, redeclaration not allowed
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.
________________________________
cameron
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.
________________________________
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.
Re: Help, redeclaration not allowed
You need to lose the semicolon here.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 );
Chili
Re: Help, redeclaration not allowed
Alright thanks fixed it. seeing what the problem was lead to mutiple face palms.