Important: Please read the Qt Code of Conduct -

Cannot link directX to Qt

  • Hey , I've tried to add the path and libs to my pro file and it doesn't work


    INCLUDEPATH += $$PWD/../../../../Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include
    DEPENDPATH += $$PWD/../../../../Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include\

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x64/ -ld3d9
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x64/ -ld3d9d


    Basically when I write #include<anything> for example a header called d3dx9tex.h it doesn't recognize it , and this:

    #include<Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include/d3d9.h>
    #include<Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include/d3dx9tex.h>
    #include<Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include/d3dx9.h>

    gives me errors which is " no such file or directory "

    not sure if there's a prefix which I should use before the name of the header ? if so which is it ?

  • There are the backslashes at the end of INCLUDEPATH and DEPENDPATH.
    Try to remove those backslashes.

    Also, if it is possible, try to avoid spaces in the paths.

  • Thanks for replying , I'm sorry about the backslashes I added them myself since Qt won't add if you tried to add a library.

    Still doesn't work :(

    Well since I installed it in this path , I don't think moving it to another path is a good idea :(

  • Lifetime Qt Champion


    Do you mean that you still can't use the includes ? Did you try with an absolute path ? e.g.

    @INCLUDEPATH += C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include@

    Like andreyc said, the backslashes where you put them means that the following line should be happened to the current one, which you don't want in your case.

  • Thank you , I actually solved it after moving it and modifying to this:

    INCLUDEPATH +=C:/DirectXSDK/Include
    LIBS += C:/DirectXSDK/Lib/x86/d3d9.lib
    LIBS += C:/DirectXSDK/Lib/x86/d3dx9d.lib
    LIBS += C:/DirectXSDK/Lib/x86/d3dx9.lib

    there are some problems " crashing " but I don't think it's Qt related . so thanks all of u

Log in to reply