Cygwin SDL windows.h

Hi,
im working on a program which has to process data coming through the serial port then create an interface with SDL.I did 1 program to receive the data n process them n another program for the interface using sdl.They both work perfectly.Im started having problems when i wanted to merge the two programs.Here is a simplified version of the merged program n the errors.Thanks in advance.Im trying to fix this problem for about a week but cant.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#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;
}


i compile using gcc -o test test.c -lmingw -lSDLmain -lSDL -mwindows -lSDL_image

this is the errors i got 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! n many errors like that.
The problem is your linking -lmingw. You should be linking -lmingw32.
Last edited on
Topic archived. No new replies allowed.