Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to include SDL lib



  • Hi, Qt community.
    I have some truble with icluding SDL lib in Qt 5.2.1.
    Anybody do it?
    In *.pro i write:
    @
    INCLUDEPATH += C:/SDL-1.2.15/include/SDL
    LIBS += C:/SDL-1.2.15/lib -lSDL

    HEADERS +=
    test.h

    SOURCES +=
    test.cpp

    QT += core gui
    @
    And when i compile it, I have three errors:
    @
    :-1: error: cannot find C:/SDL-1.2.15/lib: Permission denied
    :-1: error: cannot find -lSDL
    collect2.exe:-1: error: error: ld returned 1 exit status
    @
    What does it means?
    Community help me pleas.


  • Lifetime Qt Champion

    Hi,

    You are missing a -L before C:/SDL-1.2.15/lib

    So it should be

    @LIBS += -LC:/SDL-1.2.15/lib -lSDL@



  • Oh thanks, I don't know about it!



  • Thats great!
    I write my projekt, hi is compilet, but don't started.
    I think it is a problem with SDL lib, I del all my projekt and write simple program.
    @
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>

    int main()
    {
    int a,b;
    printf("vvedite a\n");
    scanf("%d\n",&a);
    printf("vvedite b\n");
    scanf("%d\n",&b);
    printf("%d\n",a+b);
    }
    @

    then I build it.
    But when I started I have an error 0cx0000139.


  • Lifetime Qt Champion

    It means you are missing one or several dlls which I suspect are those from SDL. Go to the Project panel -> run and update the PATH variable adding the path to your SDL dlls. Then you should be good to go


Log in to reply