quickNitin
19th June 2006, 06:53
following errors i am getting on execution. Related part of code i am presenting.
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.1.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.1.2/include/QtCore -I/usr/local/Trolltech/Qt-4.1.2/include/QtNetwork -I/usr/local/Trolltech/Qt-4.1.2/include/QtGui -I/usr/local/Trolltech/Qt-4.1.2/include -I. -I. -o client.o client.cpp
client.cpp: In member function ‘void Client::calculating()’:
client.cpp:112: error: invalid use of member (did you forget the ‘&’ ?)
client.cpp:113: error: invalid use of member (did you forget the ‘&’ ?)
client.cpp:125: error: invalid use of member (did you forget the ‘&’ ?)
client.cpp:128: error: no matching function for call to ‘Client::startSending(<unknown type>, <unknown type>)’
client.h:53: note: candidates are: void Client::startSending(int, int)
client.cpp:129: error: invalid use of member (did you forget the ‘&’ ?)
client.cpp:137: error: invalid use of member (did you forget the ‘&’ ?)
client.cpp:142: error: invalid use of member (did you forget the ‘&’ ?)
make: *** [client.o] Error 1
swap is not a member of class.
void swap(int *a,int *b)
{
int *t;
*t = *a;
*a = *b;
*b = *t;
}
int x,y,x1=0, y10=0 ,x2=100,y2=100,e,dy,dx,absolute; //declared at global scope, not member of class
void Client::calculating()
{
if(x1>x2)
{
swap(&x1,&x2);
swap(&y10,&y2);
}
x = x1;
y = y10;
if((y2-y10)<0)
absolute = -1;
else
absolute = 1;
dy = absolute*(y2-y10);
dx = x2-x1;
//usleep(1000*1000*1);
e = (2*dy)-dx;
while( x < x2)
{
emit startSending(x,y);
x = x+1;
if(e<0)
e = e+(2*dy);
else
if (y10>y2)
{
y = y-1;
e = e+(2*dy)-(2*dx);
}
else
{
y = y+1;
e = e+(2*dy)-(2*dx);
}
}
}
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.1.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.1.2/include/QtCore -I/usr/local/Trolltech/Qt-4.1.2/include/QtNetwork -I/usr/local/Trolltech/Qt-4.1.2/include/QtGui -I/usr/local/Trolltech/Qt-4.1.2/include -I. -I. -o client.o client.cpp
client.cpp: In member function ‘void Client::calculating()’:
client.cpp:112: error: invalid use of member (did you forget the ‘&’ ?)
client.cpp:113: error: invalid use of member (did you forget the ‘&’ ?)
client.cpp:125: error: invalid use of member (did you forget the ‘&’ ?)
client.cpp:128: error: no matching function for call to ‘Client::startSending(<unknown type>, <unknown type>)’
client.h:53: note: candidates are: void Client::startSending(int, int)
client.cpp:129: error: invalid use of member (did you forget the ‘&’ ?)
client.cpp:137: error: invalid use of member (did you forget the ‘&’ ?)
client.cpp:142: error: invalid use of member (did you forget the ‘&’ ?)
make: *** [client.o] Error 1
swap is not a member of class.
void swap(int *a,int *b)
{
int *t;
*t = *a;
*a = *b;
*b = *t;
}
int x,y,x1=0, y10=0 ,x2=100,y2=100,e,dy,dx,absolute; //declared at global scope, not member of class
void Client::calculating()
{
if(x1>x2)
{
swap(&x1,&x2);
swap(&y10,&y2);
}
x = x1;
y = y10;
if((y2-y10)<0)
absolute = -1;
else
absolute = 1;
dy = absolute*(y2-y10);
dx = x2-x1;
//usleep(1000*1000*1);
e = (2*dy)-dx;
while( x < x2)
{
emit startSending(x,y);
x = x+1;
if(e<0)
e = e+(2*dy);
else
if (y10>y2)
{
y = y-1;
e = e+(2*dy)-(2*dx);
}
else
{
y = y+1;
e = e+(2*dy)-(2*dx);
}
}
}