Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Startup Directory Problem
Forum Updated to NodeBB v4.3 + New Features

Startup Directory Problem

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
6 Posts 4 Posters 852 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DJCinSB
    wrote on last edited by
    #1

    I'm building a shell in Qt that drives a program built externally. I'm having trouble getting the debug environment configured using Qt Creator 4.12.3 under Ubuntu 20.04. My project is cmake based. (Previous work always used qmake, so this piece is new to me.) The Qt interface builds correctly and I have a custom build step that copies the executable to the correct run time folder. That folder contains files that must be read at startup, along with several project libraries. I have the Qt Creator "Working Directory" setting for the Run settings pointing to the run time folder as well. The Qt application built this way runs as expected when started from a Linux terminal.

    When I try to run the built application from inside of Qt Creator, either with the debugger or without it by pressing the "play" button, the application fails to launch and indicates that it cannot find the application libraries. The application acts as if it is running them the Qt build folder ("build-GTK-Desktop_Qt_5_15_0_GCC_64bit-Debug" for my desktop application named GTK) rather than from the folder that I need it to use. How do I set the application startup folder for runs made inside of the debugger?

    (I expected the "Working Directory" setting to do this, but it does not seem to be what I need with this configuration.)

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Uncheck the checkbox Projects->Build->Shadow build and rebuild your project.

      (Z(:^

      D 1 Reply Last reply
      2
      • sierdzioS sierdzio

        Uncheck the checkbox Projects->Build->Shadow build and rebuild your project.

        D Offline
        D Offline
        DJCinSB
        wrote on last edited by
        #3

        @sierdzio I don't see a "Shadow build" setting for a CMake based project. I do see it for qmake, but I'm configured in CMake for this project.

        jsulmJ 1 Reply Last reply
        0
        • D DJCinSB

          @sierdzio I don't see a "Shadow build" setting for a CMake based project. I do see it for qmake, but I'm configured in CMake for this project.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @DJCinSB For CMake projects you can specify the build folder in QtCreator

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          D 1 Reply Last reply
          1
          • jsulmJ jsulm

            @DJCinSB For CMake projects you can specify the build folder in QtCreator

            D Offline
            D Offline
            DJCinSB
            wrote on last edited by
            #5

            @jsulm That approach is okay, I guess (sighs), but it leaves cmake crap in the build folder. (Basically the CMakeFiles folder tree and an autogen folder tree.) For my project, the build folder is a bin folder inside of a fairly structured folder tree containing a few hundred files (data files, libraries, sample scripts, and so forth). I'd prefer to have my application placed in a target folder and launched in that folder , and the build files stored outside of that folder tree.

            The main project - which uses wxWidgets where I prefer Qt - already builds that way using CMake files. Running it in GDB/Eclipse with that configuration works as expected without having the application and build files commingled; I only need to set the run folder. I had hoped that the "Working directory" setting in Qt Creator would cd to that folder and then run the application, but it appears that it runs the app from the build folder. (I'm not clear about what the working directory setting under Run setting does at this point if it isn't the folder used for the run.) My preference is to have the Qt configuration version be as close as possible to the wx setup.

            If I don't just build in my bin folder, I may need to hack in some pieces to the Qt CMakeLists file, but I'd prefer to follow some general "best practice" guidelines rather than do something (hackish and) project specific.

            1 Reply Last reply
            0
            • hskoglundH Online
              hskoglundH Online
              hskoglund
              wrote on last edited by
              #6

              Hi, you can try adding a "Custom executable" run configuration, i.e. in the Run settings click "Add..." and then select "Custom Executable" then click Browse to select your custom run time folder and the .exe/elf file in there.

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved