4

I'm trying to find an equivalent feature in Qt Creator that I currently know how to do in Visual Studio.

In Visual Studio I'm able to modify the PATH environment in the Property Pages-> Configuration Properties-> Debugging-> Environment and I can set something like:

PATH=%PATH%;%MYENVIRONMENTVAR%

Where MYENVIRONMENTVAR points to a directory (lets call it C:\MYIMPORTANTDLLS) containing dlls needed for my program to run.

I'm looking for the equivalent of this in Qt Creator. In Qt Creator I thought I would accomplish this in Projects-> Select the Run tab-> Expand the Build Environment Details and modify the Path there. But I can't append an environment variable to the end of the PATH in that location. Instead I have to append the path contained in my environment variable to the end of the entire PATH, which would look something like this: PATH=C:\path1;C:\path2;C:path3;...etc...;C:\MYIMPORTANTDLLS.

If any of you know how this is done in Qt Creator then I would appreciate your help.

2 Answers 2

2

There is a way to specify other dependencies of the project immediately in the project .pro file. Example from project file:

OTHER_FILES += ..\third-party\libxml2\bin64\libxml2.dll \
    ..\third-party\libiconv\bin64\libiconv.dll
Sign up to request clarification or add additional context in comments.

7 Comments

It didn't work for me. I added ;%MYENVIRONMENTVAR% to the end of LIBPATH and my program couldn't run because it couldn't find the dlls
Fixed. You need to modify .pro file and then do qmake and rebuild. That may copy DLLs to executable location, though.
Hmm... that's not quite what I'm trying to do. I have dlls that might change locations in the future (because I'm in my development phase). I also have different projects that are using these dlls. When/if I change the dlls location in the future I only want to make one change of paths (i.e. the path in my environment variable) thus updating all of my projects. Your solution would require me to go into every .pro file and modify the paths to every dll...
As far as I understand Qt Creator and Visual Studio are dev environments and providing convenience for debug is maybe a good feature but. But how can you be sure that you have all those dlls on the random system where you install your program to? If those are standard dlls than the paths are standard as well and you don't need to bother. If those unique ones than you need to distribute them.
They are unique dlls, so when I create an installer I will be placing the dlls with the executable. I'm merely trying to find a more convenient way of development.
|
1

You were so close with opening Projects-> Select the Run tab (or Build if you need to change the path for the build step) -> Expand the Build Environment Details and modify the Path there. Then edit the PATH variable to

$(PATH);C:\YourPathAddition

1 Comment

This is the answer for those who do not use qmake for build system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.