WolfmanZ Posted June 26, 2012 Report Share Posted June 26, 2012 Boas estou a trabalhar num projecto em Visual Studio 2010 e ao compilar deu-me este unico erro : error C2381: 'exit' : redefinition; __declspec(noreturn) differs c:\program files\microsoft visual studio 10.0\vc\include\stdlib.h 353 Alguém sabe como corrigir/emendar isto? Obrigado desde já! Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted June 26, 2012 Report Share Posted June 26, 2012 (edited) tens alguma função chamada exit ??? PS : ou alguma daquelas horríveis variáveis globais ?? Edited June 26, 2012 by HappyHippyHippo IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
WolfmanZ Posted June 26, 2012 Author Report Share Posted June 26, 2012 nao tenho nenhuma chamada exit. Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted June 26, 2012 Report Share Posted June 26, 2012 eu não perguntei por chamadas ... eu perguntei por definições : funções globais, variáveis globais, nomes de classes ... IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
WolfmanZ Posted June 26, 2012 Author Report Share Posted June 26, 2012 sim tenho Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted June 26, 2012 Report Share Posted June 26, 2012 não podes ter definições com o mesmo nome ao mesmo nível de scope !!! como achas que o compilador irá saber qual delas te queres referir ??? se já existe uma função exit (que faz parte do libc, é óbvio que n«ao pode existir mais nada a nível global com esse nome IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
WolfmanZ Posted June 27, 2012 Author Report Share Posted June 27, 2012 continua a dar o mesmo erro. Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted June 27, 2012 Report Share Posted June 27, 2012 como te foi dito, não podes ter nenhuma definição a nível global com o nome exit (estou também a assumir que estás a trabalhar em c++) com a informação escassa que dá, a única coisa que te posse pedir é que faças post do teu código e a linha correcta onde te dá o erro. IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
WolfmanZ Posted June 27, 2012 Author Report Share Posted June 27, 2012 tou a trabalhar em opengl e o erro que dá é no ficheiro da stdlib nao é no codigo error C2381: 'exit' : redefinition; __declspec(noreturn) differs c:\program files\microsoft visual studio 10.0\vc\include\stdlib.h 353 é esta linha: " _CRTIMP __declspec(noreturn) void __cdecl exit(_In_ int _Code); " Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted June 28, 2012 Report Share Posted June 28, 2012 bem ... se achas que estou a falar francês eu falo em português: Não pode ter nenhuma função global, nome de variável global, nome de classe ou definição de tipo com o nome de exit quando chamas a stdlib. disseste que tens no teu código, mas no entanto recusaste a alterar ... mais não posso fazer IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
WolfmanZ Posted June 28, 2012 Author Report Share Posted June 28, 2012 (edited) ja consegui compilar so que ha 2 coisas mal que ainda nao consegui resolver 1º nave ao rodar 360 ao andar no eixo do Y o raio aumenta tambem. 2º os tiros da nave nao se mexem fica aqui parte do codigo typedef struct{ float x,y; float v1,v2; }POINT; POINT a={0,0,0,0,}; POINT b={0,0,0,0,}; float X_CENTRE = 0.0; float Y_CENTRE = 0.0; float rot = 0.0; float AsteroidX[6]; float AsteroidY[6]; float angle = 0; float bulletAngle = 0; bool fired = false; float BulletLocX = a.x + (X_CENTRE); float BulletLocY = a.y + (Y_CENTRE + 5.5); bool collision = false; void drawship() //desenhar nave { if(a.x > 100){ a.x=a.x-200; } if(a.x < -100){ a.x=a.x+200; } if(a.y > 100){ a.y=a.y-200; } if(a.y < -100){ a.y=a.y+200; } glColor3f(1, 1, 1); //glLoadIdentity(); glRotatef(angle,0.0,0.0,1.0); glBegin(GL_POLYGON); glVertex2f( a.x + (X_CENTRE), a.y + (Y_CENTRE + 5)); glVertex2f( a.x +(X_CENTRE + 5), a.y +( Y_CENTRE - 9)); glVertex2f( a.x + X_CENTRE, a.y + (Y_CENTRE -7)); glVertex2f( a.x +( X_CENTRE -5), a.y + (-9)); glEnd(); glFlush(); } void drawBullet() { glLoadIdentity(); glRotatef(angle,0.0,0.0,1.0); glColor3f(0, 0, 1); glPointSize(3.0); glBegin(GL_POINTS); glVertex2f(a.x + (X_CENTRE), a.y + (Y_CENTRE + 5.5)); glEnd(); //glFlush(); } void keyinput(int key, int x, int y) { switch(key){ case GLUT_KEY_UP: a.y = a.y + 1; break; case GLUT_KEY_LEFT: angle = angle + 5; break; case GLUT_KEY_RIGHT: angle = angle - 5; break; case GLUT_KEY_DOWN: a.y = a.y - 1; break; } } void shoot(unsigned char key,int x, int y){ switch(key){ case 32: if(fired != true){ bulletAngle = angle + 90; bulletAngle = (bulletAngle * 3.142)/180; } fired = true; break; } } void bulletPath(){ BulletLocX = 0 + (5*cos(bulletAngle)/10); glutPostRedisplay(); BulletLocY = 5.5 + (5*sin(bulletAngle)/10); glutPostRedisplay(); } void display(void) { glClear (GL_COLOR_BUFFER_BIT); glClearColor(0.0, 0.0, 0.0, 1.0); glPointSize(1.0); drawBullet(); drawAsteroid(); drawship(); drawScore(); if (fired) { bulletPath(); } CollisionTest(); if(BulletLocX > 100.0 || BulletLocX < -100.0 || BulletLocY > 100.0 || BulletLocY < -100.0 || collision == true) { collision = false; fired = false; BulletLocX = BulletLocX; BulletLocY = BulletLocY; } } Edited July 13, 2012 by Baderous geshi Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now