elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Temas
Páginas: 1 [2]
11  Programación / Programación C/C++ / el programa dejó de funconar correctamente por un problema. en: 11 Septiembre 2016, 20:48 pm
Cuando trato de ejecutar el siguiente programa en c++ me sale el error:

el programa dejó de funcionar correctamente por un problema. Windows cerrará el programa y le notificará si existe una solución.

el compilador no me da ningún problema el código es el siguiente:
Código:
#include <stdio.h>
#include <stdlib.h>
#include <allegro.h>
#include <iostream>

int iniciar();
void realizar_juego();
void terminar();

int iniciar(){
allegro_init();
install_keyboard();
set_color_depth(16);
if (set_gfx_mode(GFX_AUTODETECT,640,480,0,0)<0){
printf("error al iniciar el modo grafico\n");
allegro_exit();
exit(-1);
}
}

void terminar(){
allegro_exit();
}
int main(){
iniciar();
realizar_juego();
terminar();
}
END_OF_MAIN()
void realizar_juego(){

BITMAP *nave;
PALETTE paleta;
int x,y, x_anterior, y_anterior;
BITMAP * buffer;


nave=load_bitmap("C:/Users/DANIEL/Desktop/Programación/C++/Allegro/Naves/recursos/nave.pcx", paleta);
set_palette(paleta);
if (nave==NULL) terminar();
buffer=create_bitmap(nave->w,nave->h);
clear (buffer);
if (buffer==NULL) terminar();
x=SCREEN_W/2;
y=SCREEN_H/2;

while (!key[KEY_ESC]){

if (key[KEY_UP,KEY_W])
y--;
if (key[KEY_DOWN,KEY_S])
y++;
if (key[KEY_LEFT,KEY_A])
x--;
if (key[KEY_RIGHT,KEY_D])
x++;

if (x<0) x=x_anterior;
if (x>SCREEN_W-nave->w) x=x_anterior;
if (y<0) y=y_anterior;
if (y>SCREEN_H-nave->h) y=y_anterior;
if ((x_anterior!=x) || (y_anterior!=y)){
blit (buffer,screen, 0, 0, x_anterior, y_anterior,buffer->w,buffer->h);
blit (screen,buffer,x,y,0,0,buffer->w,buffer->h);
draw_sprite(screen,nave, x, y);
}
x_anterior=x;
y_anterior=y;


}
}
12  Programación / Programación C/C++ / aiudaaa!!! en: 2 Septiembre 2016, 16:17 pm
Llevo toda la mañana tratando soluconar el siguiente error: id returned 1 ext status
                                                                      undefined reference to `WinMain@16' (utilizo dev c++)

Utilizo el compilador TMD-GCC 4.9.2 32-BIT RELEASE

este es el codigo que trato de compilar:
Código:
#include <stdio.h>
#include <stdlib.h>
#include <allegro.h>
#include <iostream>

int iniciar();
void realizar_juego();
void terminar();

int iniciar(){
allegro_init();
install_keyboard();
set_color_depth(16);
if (set_gfx_mode(GFX_AUTODETECT,640,480,0,0)<0){
printf("error al iniciar el modo grafico\n");
allegro_exit();
exit(-1);
}
}

void terminar(){
allegro_exit();
}
int main(){
iniciar();
realizar_juego();
terminar();
}
void realizar_juego(){

BITMAP *nave;
PALETTE paleta;
int x,y, x_anterior, y_anterior;
BITMAP * buffer;


nave=load_bitmap("C:/Users/DANIEL/Desktop/Programación/C++/Allegro/Naves/recursos/nave.pcx", paleta);
set_palette(paleta);
if (nave==NULL) terminar();
buffer=create_bitmap(nave->w,nave->h);
clear (buffer);
if (buffer==NULL) terminar();
x=SCREEN_W/2;
y=SCREEN_H/2;

while (!key[KEY_ESC]){

if (key[KEY_UP,KEY_W])
y--;
if (key[KEY_DOWN,KEY_S])
y++;
if (key[KEY_LEFT,KEY_A])
x--;
if (key[KEY_RIGHT,KEY_D])
x++;

if (x<0) x=x_anterior;
if (x>SCREEN_W-nave->w) x=x_anterior;
if (y<0) y=y_anterior;
if (y>SCREEN_H-nave->h) y=y_anterior;
if ((x_anterior!=x) || (y_anterior!=y)){
blit (buffer,screen, 0, 0, x_anterior, y_anterior,buffer->w,buffer->h);
blit (screen,buffer,x,y,0,0,buffer->w,buffer->h);
draw_sprite(screen,nave, x, y);
}
x_anterior=x;
y_anterior=y;


}
}
gracias!!
13  Programación / Programación C/C++ / c++ en: 2 Septiembre 2016, 15:41 pm
el caso es que cuando intento compilar en c++ me dice: error id returned 1 exit status, llevo toda la mañana buscando en internet y no encuentro nada que me sirva, ayuda por favor!!
Páginas: 1 [2]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines