[Solved] How do I create subdirectories in Qt Creator?



  • Hi everybody, I've just started trying to port an OpenGL program I made in Visual Studio to Qt Creator so I can expand it with a UI, but I'm finding it difficult to get the layout I had originally:

    !http://img8.imageshack.us/img8/7933/vstoqtproject.jpg(Visual Studio layout)!

    As you can see there's a few subdirectories that hold a library (GL Tools) that I'm using for the application. One of the big problems is that I don't know how to implement subdirectories in the Qt Creator projects view (and whatever I did try didn't seem to work). How exactly do I accomplish this?

    Help and advice are greatly appreciated!



  • Are you using a .pro file? i had the experience with cmake that if i opened the project from a cmake file i'd just get a flat list. If i use a .pro file however it works fine for me just by having the files in a separate folder and it maintains the directory structure.



  • [quote author="SimonL" date="1311654274"]Are you using a .pro file? i had the experience with cmake that if i opened the project from a cmake file i'd just get a flat list. If i use a .pro file however it works fine for me just by having the files in a separate folder and it maintains the directory structure.[/quote]

    Yeah, I'm trying to use a .pro file with it, and not having much luck so far. Here's what I have in it so far:

    @HEADERS +=
    WndProc.h
    WindowManager.h
    main.h
    GraphicsManager.h
    EntryPoint.h
    Application.h
    GL Tools/StopWatch.h
    GL Tools/math3d.h
    GL Tools/GLTriangleBatch.h
    GL Tools/GLTools.h
    GL Tools/GLShaderManager.h
    GL Tools/GLMatrixStack.h
    GL Tools/GLGeometryTransform.h
    GL Tools/GLFrustum.h
    GL Tools/GLFrame.h
    GL Tools/GLBatchBase.h
    GL Tools/GLBatch.h

    SOURCES +=
    WndProc.cpp
    WindowManager.cpp
    main.cpp
    GraphicsManager.cpp
    EntryPoint.cpp
    Application.cpp
    GL Tools/math3d.cpp
    GL Tools/GLTriangleBatch.cpp
    GL Tools/GLTools.cpp
    GL Tools/GLShaderManager.cpp
    GL Tools/GLBatch.cpp

    LIBS += glu32.lib
    opengl32.lib
    glew32s.lib
    @

    Yet it only appears in the project explorer as this:

    !http://img846.imageshack.us/img846/9652/vstoqtproject2.jpg(Qt Project Explorer)!

    Am I doing something wrong?

    Also on a side note, when I try to build the project I get the error ":-1: error: No rule to make target GL', needed bydebug/GL.o'. Stop." (using MinGW). So if anybody knows, help would be appreciated on that as well.

    MAJOR EDIT AND SOLUTION: I have the subdirectories working now, it's because the folder "GL Tools" had a space in it! I renamed it to "GLTools" and it works now, not to mention that error went away (which is how I started thinking of the solution, because it couldn't find "GL").

    Thanks for the suggestions SimonL!


  • Moderators

    The .pro file doesn't like spaces in the directory name. If you remove them you should be good to go.

    Edit: Wow. Completely didn't see the last half of your last post (or the [Solved] in the title). I guess I got too excited about figuring out the problem. :-) I need to start getting more sleep, I think.



  • [quote author="mlong" date="1311704016"]Edit: Wow. Completely didn't see the last half of your last post (or the [Solved] in the title). I guess I got too excited about figuring out the problem. :-) I need to start getting more sleep, I think.
    [/quote]

    Haha, it's fine, I do that quite a bit too at times. :D


Log in to reply
 

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