SDL et windows.h sous sygwin

agent933 Messages postés 5 Date d'inscription jeudi 30 octobre 2008 Statut Membre Dernière intervention 9 février 2010 - 9 févr. 2010 à 20:52
agent933 Messages postés 5 Date d'inscription jeudi 30 octobre 2008 Statut Membre Dernière intervention 9 février 2010 - 9 févr. 2010 à 21:22
salut
je travaille en ce moment sur un programme en langage.grosso modo jutilise le port serie pour recevoir donnees et ensuite utilise une interface sdl.g ecri a part le prog pour recevoir les donnees via le port serie et linterface sdl.les 2 prog marchent parfaitement.ca c complique quand g essaye de fusionner les 2 prog.je sui presk sur davoir installe les librairies necessaires mais g toujours la meme erreur ca fait plus dune semaine ke javance pa a coz de ca.
voici une version test de mon prog et le message derreur,merci davance!

#ifdef WIN32
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#pragma comment(lib, "SDL_image.lib")
#endif

#include <windows.h>
#include <stdlib.h>
#include "SDL/SDL.h"
#include "SDL_Image.h"

#define TRUE 1
#define FALSE 0


#define RX_SIZE         4096    /* taille tampon d'entree  */
#define TX_SIZE         4096    /* taille tampon de sortie */
#define MAX_WAIT_READ   5000    /* temps max d'attente pour lecture (en ms) */



/* Handle du port COM ouvert */
HANDLE g_hCOM = NULL;

/* Delais d'attente sur le port COM */
COMMTIMEOUTS g_cto =
{
    MAX_WAIT_READ,  /* ReadIntervalTimeOut          */
    0,              /* ReadTotalTimeOutMultiplier   */
    MAX_WAIT_READ,  /* ReadTotalTimeOutConstant     */
    0,              /* WriteTotalTimeOutMultiplier  */
    0               /* WriteTotalTimeOutConstant    */
};

/* Configuration du port COM */
DCB g_dcb =
{
    sizeof(DCB),        /* DCBlength            */
    57600,               /* BaudRate             */
    TRUE,               /* fBinary              */
    FALSE,              /* fParity              */
    FALSE,              /* fOutxCtsFlow         */
    FALSE,              /* fOutxDsrFlow         */
    DTR_CONTROL_ENABLE, /* fDtrControl          */
    FALSE,              /* fDsrSensitivity      */
    FALSE,              /* fTXContinueOnXoff    */
    FALSE,              /* fOutX                */
    FALSE,              /* fInX                 */
    FALSE,              /* fErrorChar           */
    FALSE,              /* fNull                */
    RTS_CONTROL_ENABLE, /* fRtsControl          */
    FALSE,              /* fAbortOnError        */
    0,                  /* fDummy2              */
    0,                  /* wReserved            */
    0x100,              /* XonLim               */
    0x100,              /* XoffLim              */
    8,                  /* ByteSize             */
    NOPARITY,           /* Parity               */
    ONESTOPBIT,         /* StopBits             */
    0x11,               /* XonChar              */
    0x13,               /* XoffChar             */
    '?',                /* ErrorChar            */
    0x1A,               /* EofChar              */
    0x10                /* EvtChar              */
};

/*Fonctions du module.
*/
BOOL OpenCOM    (int nId);
BOOL CloseCOM   ();
BOOL ReadCOM    (void* buffer, int nBytesToRead, int* pBytesRead);
void extract (unsigned char buffer[], unsigned char skinf[], unsigned char eyef[]);
int condata(unsigned char a,unsigned char b);
float Lux(unsigned char taosch0,unsigned char taosch1);
int tempconv(uint16_t TempData);

int main(int argc, char *argv[])
{
SDL_Surface *screen;
SDL_Surface *picture;
SDL_Event event;
SDL_Rect pictureLocation;	
const SDL_VideoInfo* videoinfo;

atexit(SDL_Quit);


/* Initialize the SDL library */
if( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr,
"Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}

screen = SDL_SetVideoMode(640, 480, 32, SDL_DOUBLEBUF | SDL_HWSURFACE);
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
SDL_GetError());
exit(1);
}

videoinfo = SDL_GetVideoInfo();

printf("%i", videoinfo->blit_hw);

// Load Picture
picture = IMG_Load("smiley2.bmp");

if (picture == NULL) {
fprintf(stderr, "Couldn't load %s: %s\n", "SDL_now.bmp", SDL_GetError());
return 0;
}

pictureLocation.x = 210;
pictureLocation.y = 100;

while(1) {

SDL_FillRect(screen, NULL, 1000);
SDL_BlitSurface(picture, NULL, screen, &pictureLocation);
SDL_Flip(screen);

}

return 0;
}

1 réponse

agent933 Messages postés 5 Date d'inscription jeudi 30 octobre 2008 Statut Membre Dernière intervention 9 février 2010
9 févr. 2010 à 21:22
au cas ou limage safficherai pa
g un warning du genre cannot find entry symbol _winmainstartup;defaulting 00401000
ensuite d erreurs du genre /usr/lib/gcc-lib/i686/..libSDLmain.a(SDL_win32_main.o)...undefined reference to '__pctype!
et pleins autres du genre.
kan jefface le windows.h lerreur disparait mais il reconnai plus le handle g_hCom.
0
Rejoignez-nous