glfwInit causing application to hang

Using GLFW
OandO
2014-04-12
2014-04-15
  • OandO
    OandO
    2014-04-12

    I've just updated to GLFW3 (Running on MacOSX 10.9). The library built just fine, and the application builds without any errors (it's a just a main function with glfwInit/Terminate for the time being) but it refuses to launch properly. The sample applications included with GLFW work just fine, but my own application doesn't, instead the icon just bounces in the dick and never gets any further. Apologies for the sparse details, but as I say, it's currently just five lines of code refusing to work.

     
  • arampl
    arampl
    2014-04-12

    Show your code, please.
    EDIT: 99% it's not os related if samples runs fine.
    EDIT2: also check, do you have "return 0;" or "exit(EXIT_SUCCESS);" at the end of main function? (in Linux it does not needed, but who knows)

     
    Last edit: arampl 2014-04-12
  • OandO
    OandO
    2014-04-12

    #include <stdio.h>

    include <stdlib.h>

    include "glfw3.h"

    int main(int argc, const char * argv[])
    {
    GLFWwindow* window = NULL;
    if(!glfwInit())
    {
    return 0;
    }
    glfwTerminate();
    return 0;
    }

    That's all there is to it.
    Edit: Erm, what's the syntax for posting code around here?

     
    Last edit: OandO 2014-04-12
  • arampl
    arampl
    2014-04-12

    Plain text for syntax, i presume.

    Hmm, nothing wrong with the code, it works for me (Xubuntu).
    There must be some difference between sample applications and your program.
    May be different linkage (static / dynamic)?
    May be some project settings different (if you use IDE).
    Try to run your program from terminal - helpful messages or warnings may appear.
    You can also try to start from one of sample applications, slightly reduce them, compile&run.

     
  • arampl
    arampl
    2014-04-12

    Sorry if i'm understood incorrectly, but what do you expect from such program?
    It will not create any visible windows, just start and immediately exit.
    Same as if source would be just:
    int main()
    {
    return 0;
    }

     
  • OandO
    OandO
    2014-04-12

    I just started using a new version of Xcode today, so it's entirely possible I've got some incorrect linker settings somewhere, I'm going to have to scour them to see if there's anything noticeably wrong. I was expecting exactly the behaviour you described, but instead it gets stuck initialising GLFW and doesn't complete. I'll dig a little deeper and try to determine exactly where it's failing.

    Edit: Ok what I've found is that it builds (and then fails to run) when I link the library (which is stored inside the app bundle), but then when I quit Xcode and reopen the project, it claims not to be able to locate the library when building, despite all the paths appearing correct. Still no solution yet though, but it's looking like an Xcode issue rather than a problem with GLFW itself.

     
    Last edit: OandO 2014-04-12
  • arampl
    arampl
    2014-04-15

    Hi, OandO.

    I've found how to insert source code in the posts.
    Just use several tildes (i typed seven times) before and after code block. The code will even be highlighted:

    #include <glfw.h>
    

    Regards :)

     
    Last edit: arampl 2014-04-15