Salve, ho appena finito di creare un fake simil di pong con c++ e con la libreria allegro.h
Fino ad adesso ho compilato ed eseguito il programma utilizzando code blocks e tutto va bene. Ma se provo ad aprire il programma dal file exe che c'è all'interno della cartella debug del progetto mi esce la scritta : il prgramma nn risponde.
vi posto il codice
codice:
#include <allegro.h>
#include <iostream>

PALETTE colori;
BITMAP *asta1, *ball, *buf, *asta2, *perso;
int x, y, x1, y1, x2, y2;
int mov = 1;
int moderatore = 0;
int velocitay = 2;
int velocitax = 2;

int rimb_sx, rimb_dx, rimb_su, rimb_giu, prima_sx, prima_dx;
bool stop = false;
bool morto = false;
bool fermatisu = false;
bool fermatigiu = false;



using namespace std;

void db()
{
    vsync();
    blit (buf, screen, 0, 0, 0, 0, 456, 456);
    clear(buf);
}
void crea_lose()
{
    draw_sprite (buf, perso, 1, 1);
}
void crea_asta2()
{
    draw_sprite (buf, asta2, x2, y2);
}

   void crea_asta1()
{
    draw_sprite (buf, asta1, x, y);
}
void crea_ball ()
{
    if (morto == false)
    {
    draw_sprite (buf, ball, x1, y1);
    }
}
void movimento1()
{

    if (fermatisu == false)
    {
    if (key[KEY_UP])
    {
        y -= 6;
    }
    }

    if (fermatigiu == false)
    {
    if (key[KEY_DOWN])
    {
        y += 6;
    }
    }
    if (y <= 9)
    {
        fermatisu = true;
    }
    else
    {
        fermatisu = false;
    }
    if (y >= 415)
    {
        fermatigiu = true;
    }
    else
    {
        fermatigiu = false;
    }

}
void movimento2()
{
    int latodx1 = x + 15;
    int latogiu1 = y + 20;
    int latosx2 = x2 - 15;
    int latogiu2 = y2 + 20;
    int latosu2 = y2 - 15;
    if (mov == 1)
    {
        x1 -= 1;
    }
    if ((x1 <= latodx1) && (y1 <= latogiu1 && y1 >= y - 15))
    {
        rimb_sx = 1;
        rimb_dx = 0;
        rimb_giu = 0;
        rimb_su = 0;
        mov = 0;
        prima_sx = 1;
        prima_dx = 0;
    }
    if ((y1 <= 10) && (x1 >= latodx1))
    {
        rimb_sx = 0;
        rimb_dx = 0;
        rimb_giu = 0;
        rimb_su = 1;
        mov = 0;

    }
    if ((y1 >= 436) && (x1 >= latodx1))
    {
        rimb_sx = 0;
        rimb_dx = 0;
        rimb_giu = 1;
        rimb_su = 0;
        mov = 0;
    }
    if ((x1 >= latosx2) && (y1 <= latogiu2 && y1 >= latosu2 ))

    {
        rimb_sx = 0;
        rimb_dx = 1;
        rimb_giu = 0;
        rimb_su = 0;
        mov = 0;
        prima_dx = 1;
        prima_sx = 0;
        moderatore += 1;

    }
    if ((rimb_sx == 1) && (y1 < y))
    {
        rimb_sx = 2;
    }
    if ((rimb_sx == 1) && (y1 > y))
    {
        rimb_sx = 3;
    }
    if ((rimb_sx == 1) && (y1 == y))
    {
        rimb_sx = 4;
    }
    if (rimb_sx == 2)
    {
        x1 += velocitax;
        y1 -= velocitay;
    }
    if (rimb_sx == 3)
    {
        x1 += velocitax;
        y1 += velocitay;
    }
    if (rimb_sx == 4)
    {
        x1 += velocitax;
    }
     if ((rimb_dx == 1) && (y1 < y))
    {
        rimb_dx = 2;
    }
    if ((rimb_dx == 1) && (y1 > y))
    {
        rimb_dx = 3;
    }
    if ((rimb_dx == 1) && (y1 == y))
    {
        rimb_dx = 4;
    }
    if (rimb_dx == 2)
    {
        x1 -= velocitax;
        y1 -= velocitay;
    }
    if (rimb_dx == 3)
    {
        x1 -= velocitax;
        y1 += velocitay;
    }
    if (rimb_dx == 4)
    {
        x1 -= velocitax;
    }
    if ((rimb_giu == 1) && (prima_sx == 1))
    {
        x1 += velocitax;
        y1 -= velocitay;
    }
    if ((rimb_giu == 1) && (prima_dx == 1))
    {
        x1 -= velocitax;
        y1 -= velocitay;
    }
    if ((rimb_su == 1) && (prima_sx))
    {
        x1 += velocitax;
        y1 += velocitay;
    }
    if ((rimb_su == 1) && (prima_dx))
    {
        x1 -= velocitax;
        y1 += velocitay;
    }
    if (x1 <= 0 || x1 >= 456)
    {
        morto = true;
    }
    if (moderatore == 5)
    {
        velocitay += 1;
        velocitax += 2;
        moderatore = 0;
    }


}
void movimento3()
{

 if (stop == false)
 {
        if (y1 > y2)
        {
            y2 += 10;
        }
        if (y1 < y2)
        {
            y2 -= 10;
        }
 }
    if ((y1 <= y2 || y1 >= y2) && (y1 >= y2 - 15) && (y1 <= y2 + 20))
    {
        stop = true;
    }
    else
    {
        stop = false;
    }


}


using namespace std;

int main()
{
    allegro_init();
    install_keyboard();
    set_color_depth(32);
    set_pallete (colori);
    set_gfx_mode(GFX_AUTODETECT_WINDOWED, 456, 456, 0, 0);
    buf = create_bitmap (456, 456);
    clear(buf);

    x = 10;
    y = 10;
    x1 = 200;
    y1 = 350;
    x2 = 437;
    y2 = 10;
    while (!key[KEY_ESC])
    {





        asta2 = load_bmp ("asta.bmp", colori);
        asta1 = load_bmp ("asta.bmp", colori);
        ball = load_bmp ("ball.bmp", colori);
        db();
        crea_asta1();
        crea_asta2();
        crea_ball();
        movimento1();
        movimento2();
        movimento3();
        if (morto == true)
        {
            goto fine;
        }





    }
    fine:



        destroy_bitmap(buf);
        destroy_bitmap(asta1);
        destroy_bitmap(ball);
        destroy_bitmap(asta2);
        destroy_bitmap(perso);

    return 0;
}
END_OF_MAIN();
RIPETO eseguendolo con codeblocks funziona, ma se apro il file exe mi esce un avviso con scritto : il programma non risponde.