Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Windows Deployment: dealing with variable PATH
Forum Updated to NodeBB v4.3 + New Features

Windows Deployment: dealing with variable PATH

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 472 Views 1 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.
  • X Offline
    X Offline
    xtingray
    wrote on last edited by xtingray
    #1

    Hi,
    Currently, I am developing a Windows application using shared libraries. The way I launch it is calling a .bat script, just like this one:

    @echo OFF
    set PATH=..\lib;..\lib\qt5;..\lib\libav
    app.exe %1
    

    It works like a charm, but I wonder if there is a way to avoid the .bat script by defining the variable PATH from the main.cpp code of my app. Just guessing, in that way I would be able to open my application just clicking on the app.exe binary.

    Is there a way to make this possible without compiling the app as static? I appreciate any hint.


    Qt Developer

    jsulmJ 1 Reply Last reply
    0
    • 6thC6 Offline
      6thC6 Offline
      6thC
      wrote on last edited by
      #2

      Would http://doc.qt.io/qtcreator/creator-build-settings.html#build-environment help?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ambershark
        wrote on last edited by
        #3

        It looks like you are trying to add library paths to your app. If that is the case you could check out QCoreApplication::addLibraryPath. That should do what you need without the need for the .bat script and the modification to the system path.

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply
        2
        • X xtingray

          Hi,
          Currently, I am developing a Windows application using shared libraries. The way I launch it is calling a .bat script, just like this one:

          @echo OFF
          set PATH=..\lib;..\lib\qt5;..\lib\libav
          app.exe %1
          

          It works like a charm, but I wonder if there is a way to avoid the .bat script by defining the variable PATH from the main.cpp code of my app. Just guessing, in that way I would be able to open my application just clicking on the app.exe binary.

          Is there a way to make this possible without compiling the app as static? I appreciate any hint.

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

          @xtingray To add to @ambershark : take a look at http://doc.qt.io/qt-5/qt-conf.html

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

          1 Reply Last reply
          3

          • Login

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