SDL2 Command prompt error

  • Keenonthedaywalker
    Likes 0

    Problem Description

    I get this error: C:\Users\Keenon\Desktop\SDLMinGW>g++ main.cpp -IC:\Users\Keenon\Desktop\Coding\SDL2_MinGW_X64\i686-w64-mingw32\include -LC:\Users\Keenon\Desktop\Coding\SDL2_MinGW_X64\i686-w64-mingw32\lib -w -Wl,-subsystem,windows -lmingw32 -lSDL2main -lSDL2 -o SDLMain
    c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Keenon\Desktop\Coding\SDL2_MinGW_X64\i686-w64-mingw32\lib/libSDL2main.a(SDL_windows_main.o): in function `main_getcmdline':
    /Users/valve/release/SDL/SDL2-2.0.9-source/foo-x86/../src/main/windows/SDL_windows_main.c:175: undefined reference to `SDL_main'
    collect2.exe: error: ld returned 1 exit status  

    How do I fix it? 

  • Sonar Systems admin
    Likes 0

    When does this occur?

  • Keenonthedaywalker
    Likes 0

    Once I’ve typed out this:    

    g++ main.cpp -IC:\Users\Keenon\Desktop\Coding\SDL2_MinGW_X64\i686-w64-mingw32\include -LC:\Users\Keenon\Desktop\Coding\SDL2_MinGW_X64\i686-w64-mingw32\lib -w -Wl,-subsystem,windows -lmingw32 -lSDL2main -lSDL2 -o SDLMain

    And then I just pressed enter and it gave me the error.

  • Sonar Systems admin
    Likes 0

    Try the steps again

  • Keenonthedaywalker
    Likes 0

    Ok, I will try that. 

  • Sonar Systems admin
    Likes 0

    Great      

  • Keenonthedaywalker
    Likes 0

    No Luck :(

  • Sonar Systems admin
    Likes 0

    Same error?

  • Keenonthedaywalker
    Likes 0

    Yeah, same error. Any idea what it could be? 

  • Sonar Systems admin
    Likes 0

    What version are you using?

  • Keenonthedaywalker
    Likes 0

    I’m using version 2.0.9

  • Sonar Systems admin
    Likes 0

    Try a slightly older version.

  • Keenonthedaywalker
    Likes 0

    Ok, I’ll try that.

  • Sonar Systems admin
    Likes 0

    Let me know how it goes.

  • Keenonthedaywalker
    Likes 0

    Ok, I got one step closer to success, but now I have another error! 

    Here’s the new error: main.cpp:3:10: fatal error: SDL2/SDL.h: No such file or directory
     #include <SDL2/SDL.h>
              ^~~~~~~~~~~~
    compilation terminated.

    This leads me to believe that, somehow the directories aren’t reaching eachother or something along those lines.

  • Sonar Systems admin
    Likes 0

    Which version are you trying now?

  • Keenonthedaywalker
    Likes 0

    I’m now using version 2.0.9

  • Sonar Systems admin
    Likes 0

    That’s the same version

  • Keenonthedaywalker
    Likes 0

    Yeah sorry, I should be more specific. I downloaded version 2.0.9 but the Mingw one, which I did not previously have and I think that mightve solved my first problem. 

  • Sonar Systems admin
    Likes 0

    It’s working now?

  • Keenonthedaywalker
    Likes 0

    No, unfortunatly not. I’m slowly losing my mind.

  • Sonar Systems admin
    Likes 0

    Try another method outside of mingw

  • Keenonthedaywalker
    Likes 0

    I’ll try that. Anyways thanks for your help and patience this past week, appreciate it a lot. Goodbye and thanks again. 

  • Sonar Systems admin
    Likes 0

    Good luck

  • Keenonthedaywalker
    Likes 0

    Thanks.

  • Sonar Systems admin
    Likes 0

    :D          

  • Keenonthedaywalker
    Likes 0

                         :D

Login to reply