two questions in one

Hi guys so the first question is I found eclipse made two.exes from one program I get SDLTest and SDLTest(1) I have to select SDLTest for the actualy program to run

if not the older program which just prints "hello world" compiles and runs

but the the thing is I only have one folder and exe called SDLTest yet there is two versions of this?

the second question can be answered if you have any experience with the SDL API every time I try to exit from my program click the x button on the window it freezes up,any ideas why I'll post my code

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
  #include <SDL.h>
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
    // Start SDL2

	const int SCREEN_WIDTH = 800;
	const int SCREEN_HEIGHT = 600;

   if(SDL_Init(SDL_INIT_VIDEO) < 0){

	   return 1;
   }

   SDL_Window *window = SDL_CreateWindow("Particle eXplosion",SDL_WINDOWPOS_UNDEFINED,
		   SDL_WINDOWPOS_UNDEFINED,SCREEN_WIDTH,SCREEN_HEIGHT,SDL_WINDOW_SHOWN);

   if(window == NULL){

	   cout << "window is null" << endl;
	   SDL_Quit();
       return 2;
   }

   bool quit = false;
   SDL_Event event;

   while(!quit){
   	   
	   while(SDL_PollEvent(&event)){

   		  if(event.type == SDL_QUIT){

   			  quit = true;
   		  }
   	   }
      }

   SDL_Delay(9000);
   SDL_DestroyWindow(window);
   SDL_Quit();

	return 0;
}
Looks like at some point the linker had to choose between overwriting an existing file, or renaming that existing file. So it renamed it with a 1 on the end.

As for the freezing up, add some logging.

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
  #include <SDL.h>
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
    // Start SDL2

	const int SCREEN_WIDTH = 800;
	const int SCREEN_HEIGHT = 600;

   if(SDL_Init(SDL_INIT_VIDEO) < 0){

	   return 1;
   }

   SDL_Window *window = SDL_CreateWindow("Particle eXplosion",SDL_WINDOWPOS_UNDEFINED,
		   SDL_WINDOWPOS_UNDEFINED,SCREEN_WIDTH,SCREEN_HEIGHT,SDL_WINDOW_SHOWN);

   if(window == NULL){

	   cout << "window is null" << endl;
	   SDL_Quit();
       return 2;
   }

   bool quit = false;
   SDL_Event event;

   while(!quit){
   	   
	   while(SDL_PollEvent(&event)){

   		  if(event.type == SDL_QUIT){
cout << "Event type was quit"<< endl;

   			  quit = true;
   		  }
   	   }
      }
cout << "Out of loop, about to delay" << endl;
   SDL_Delay(9000);
cout << "Delay finished, about to destroy window" << endl;
   SDL_DestroyWindow(window);
cout << "Window destroyed, about to call SDL_Quit" << endl;
   SDL_Quit();
cout << "SDL_Quit done, about to end" << endl;
	return 0;
}
thanks repeater

and great idea =)
The program "freezes" for 9 seconds because you call SDL_Delay(9000).
Topic archived. No new replies allowed.