c++ sdl window freeze and issues with sdl












0















SDL just pisses me off, please help.
I'm trying just to show a window, this is the code :



#include <iostream>
#define SDL_MAIN_HANDLED
#include "SDL.h"

int main()
{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Window *window = SDL_CreateWindow("Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 600, 480, SDL_WINDOW_SHOWN);
if (window == NULL)
return 1;
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
running = false;
break;
}
}
}
SDL_Quit();
std::cout << "Hello :)" << std::endl;
return 0;
}


Now, the issue is that it says that the program now responding and I have a "loading" icon for the mouse. Second issue is that I cannot use SDL_INIT_EVERYTHING for some reason, it just gets stuck and nothing outputs when I try to output after init.
I tried multiple sdl files x86 , x64.
I have windows 10 64bit OS.
I really start to lose my sanity here , please help.



EDIT :



the window works perfectly fine with SDL_INIT_EVERYTHING but it takes the computer to load everything for 1 minute and 50 seconds. which is a lot of time.



But when I only init SDL_INIT_VIDEO , it's not responding.
Any solution ?










share|improve this question

























  • In the first case: can you click the x button to close the window?

    – ubadub
    Nov 17 '18 at 17:46











  • @ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.

    – Daniel Nagornov
    Nov 17 '18 at 17:57











  • anyone ? please help :(

    – Daniel Nagornov
    Nov 17 '18 at 19:16











  • Why are you defining SDL_MAIN_HANDLED? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.

    – Nelfeal
    Nov 18 '18 at 7:06


















0















SDL just pisses me off, please help.
I'm trying just to show a window, this is the code :



#include <iostream>
#define SDL_MAIN_HANDLED
#include "SDL.h"

int main()
{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Window *window = SDL_CreateWindow("Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 600, 480, SDL_WINDOW_SHOWN);
if (window == NULL)
return 1;
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
running = false;
break;
}
}
}
SDL_Quit();
std::cout << "Hello :)" << std::endl;
return 0;
}


Now, the issue is that it says that the program now responding and I have a "loading" icon for the mouse. Second issue is that I cannot use SDL_INIT_EVERYTHING for some reason, it just gets stuck and nothing outputs when I try to output after init.
I tried multiple sdl files x86 , x64.
I have windows 10 64bit OS.
I really start to lose my sanity here , please help.



EDIT :



the window works perfectly fine with SDL_INIT_EVERYTHING but it takes the computer to load everything for 1 minute and 50 seconds. which is a lot of time.



But when I only init SDL_INIT_VIDEO , it's not responding.
Any solution ?










share|improve this question

























  • In the first case: can you click the x button to close the window?

    – ubadub
    Nov 17 '18 at 17:46











  • @ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.

    – Daniel Nagornov
    Nov 17 '18 at 17:57











  • anyone ? please help :(

    – Daniel Nagornov
    Nov 17 '18 at 19:16











  • Why are you defining SDL_MAIN_HANDLED? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.

    – Nelfeal
    Nov 18 '18 at 7:06
















0












0








0








SDL just pisses me off, please help.
I'm trying just to show a window, this is the code :



#include <iostream>
#define SDL_MAIN_HANDLED
#include "SDL.h"

int main()
{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Window *window = SDL_CreateWindow("Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 600, 480, SDL_WINDOW_SHOWN);
if (window == NULL)
return 1;
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
running = false;
break;
}
}
}
SDL_Quit();
std::cout << "Hello :)" << std::endl;
return 0;
}


Now, the issue is that it says that the program now responding and I have a "loading" icon for the mouse. Second issue is that I cannot use SDL_INIT_EVERYTHING for some reason, it just gets stuck and nothing outputs when I try to output after init.
I tried multiple sdl files x86 , x64.
I have windows 10 64bit OS.
I really start to lose my sanity here , please help.



EDIT :



the window works perfectly fine with SDL_INIT_EVERYTHING but it takes the computer to load everything for 1 minute and 50 seconds. which is a lot of time.



But when I only init SDL_INIT_VIDEO , it's not responding.
Any solution ?










share|improve this question
















SDL just pisses me off, please help.
I'm trying just to show a window, this is the code :



#include <iostream>
#define SDL_MAIN_HANDLED
#include "SDL.h"

int main()
{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Window *window = SDL_CreateWindow("Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 600, 480, SDL_WINDOW_SHOWN);
if (window == NULL)
return 1;
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
running = false;
break;
}
}
}
SDL_Quit();
std::cout << "Hello :)" << std::endl;
return 0;
}


Now, the issue is that it says that the program now responding and I have a "loading" icon for the mouse. Second issue is that I cannot use SDL_INIT_EVERYTHING for some reason, it just gets stuck and nothing outputs when I try to output after init.
I tried multiple sdl files x86 , x64.
I have windows 10 64bit OS.
I really start to lose my sanity here , please help.



EDIT :



the window works perfectly fine with SDL_INIT_EVERYTHING but it takes the computer to load everything for 1 minute and 50 seconds. which is a lot of time.



But when I only init SDL_INIT_VIDEO , it's not responding.
Any solution ?







c++ sdl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 17 '18 at 17:27







Daniel Nagornov

















asked Nov 17 '18 at 17:19









Daniel NagornovDaniel Nagornov

366




366













  • In the first case: can you click the x button to close the window?

    – ubadub
    Nov 17 '18 at 17:46











  • @ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.

    – Daniel Nagornov
    Nov 17 '18 at 17:57











  • anyone ? please help :(

    – Daniel Nagornov
    Nov 17 '18 at 19:16











  • Why are you defining SDL_MAIN_HANDLED? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.

    – Nelfeal
    Nov 18 '18 at 7:06





















  • In the first case: can you click the x button to close the window?

    – ubadub
    Nov 17 '18 at 17:46











  • @ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.

    – Daniel Nagornov
    Nov 17 '18 at 17:57











  • anyone ? please help :(

    – Daniel Nagornov
    Nov 17 '18 at 19:16











  • Why are you defining SDL_MAIN_HANDLED? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.

    – Nelfeal
    Nov 18 '18 at 7:06



















In the first case: can you click the x button to close the window?

– ubadub
Nov 17 '18 at 17:46





In the first case: can you click the x button to close the window?

– ubadub
Nov 17 '18 at 17:46













@ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.

– Daniel Nagornov
Nov 17 '18 at 17:57





@ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.

– Daniel Nagornov
Nov 17 '18 at 17:57













anyone ? please help :(

– Daniel Nagornov
Nov 17 '18 at 19:16





anyone ? please help :(

– Daniel Nagornov
Nov 17 '18 at 19:16













Why are you defining SDL_MAIN_HANDLED? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.

– Nelfeal
Nov 18 '18 at 7:06







Why are you defining SDL_MAIN_HANDLED? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.

– Nelfeal
Nov 18 '18 at 7:06














1 Answer
1






active

oldest

votes


















1














Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. I guess the new version just have bugs that needs to be fixed.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53353636%2fc-sdl-window-freeze-and-issues-with-sdl%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. I guess the new version just have bugs that needs to be fixed.






    share|improve this answer




























      1














      Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. I guess the new version just have bugs that needs to be fixed.






      share|improve this answer


























        1












        1








        1







        Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. I guess the new version just have bugs that needs to be fixed.






        share|improve this answer













        Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. I guess the new version just have bugs that needs to be fixed.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 17 '18 at 19:44









        Daniel NagornovDaniel Nagornov

        366




        366






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53353636%2fc-sdl-window-freeze-and-issues-with-sdl%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud

            Zucchini