SDL.h



  • I'm getting a "C:\Temp\untitled1\untitled2\main.cpp:2: error: SDL/SDL.h: No such file or directory" error for a hello SDL app. Can anyone help? I did fine with eclipse, but I want to get it going with Qt.

    .pro

    TEMPLATE = app
    CONFIG += console c++11
    CONFIG -= app_bundle
    CONFIG -= qt
    
    SOURCES += main.cpp
    INCLUDEPATH += C:/Software/SDL/INCLUDE/
         LIBS += -LC:/Software/SDL/lib -lmingw32 -mwindows -mconsole -lSDL2main -lSDL2
         CXXFLAGS = -std=c++11
    ``
    main.cpp
    

    #include <iostream>
    #include <SDL/SDL.h>

    int main(int argc, char *argv[])
    {
    SDL_Init(SDL_INIT_EVERYTHING);
    std::cout << "HELLO World!" << std::endl;
    return 0;
    }


  • Lifetime Qt Champion

    Hi,

    What exactly do you have in C:/Software/SDL/INCLUDE/ ?



  • excellent ques:

    ![include directory](![https://ibb.co/jrTrBF]())
    


  • @Technologist

    "click link" to include directory photo

    <a href="https://ibb.co/jrTrBF"><img src="https://preview.ibb.co/h3RNJv/ans_qt.png" alt="ans_qt" border="0"></a><br />



  • Now building but not running.
    I've changed the include line to just <SDL.h> and it compiles. However its crashing on run. Is this a DLL issue?

    #include <iostream>
    #include <SDL.h>

    int main(int argc, char *argv[])
    {
    SDL_Init(SDL_INIT_EVERYTHING);
    std::cout << "HELLO World!" << std::endl;
    return 0;
    }



  • Ok, I copied what was apparently a missing dll SDL2.dll to the release folder of my project and the crashing was stopped.

    Hurray

    I had to hunt these folders down (release/debug). I know in Eclipse the release and debug folders are obvious in the hierarchical project/file tree easily visible. Is it possible to have Qt creator tree do this? I've tried various options but haven't had any luck. In other words, can the tree be set to in clude release and debug?


  • Lifetime Qt Champion

    The more simple way for that is to add the path to the SDL .dlls to that PATH environment variable for the run time environment of your application.

    You can find that in the Run part of the Project panel. Do not modify the variable from your system.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.