Developing Qt Applications on Unix Systems Using Qt Creator

I am developing a Qt application on Linux using Qt Creator (2.1 RC). I created 2 projects and used the wizard to add the library project to the application project. However, when I run it, I get an error message:

/home/jakepetroules/silverlock/silverlock-build-desktop/desktop/silverlock: error while loading shared libraries: libsilverlocklib.so.1: cannot open shared object file: No such file or directory

Is there any qmake variable that I can set so that Qt Creator properly sets up the environment to run? It is very unpleasant to copy all files to another directory using the script launcher in order to be able to test the assembly. This works fine on Windows - Qt Creator automatically adds directories containing DLLs to PATH when it launches your application (where starting it from Explorer says that the DLL was not found). Mac OS X is even worse, you need to run install_name_tool on everything ...

So, how can I configure qmake files so that everything works right from the start button in Qt Creator? It’s difficult to debug without this ability.

+3
source share
3 answers

Yes, the creator has a section in which you can install any environment that you need to run your application.

In Creator 2.0.0, this is accessed by: Projects → Targetets → (your goal) → Run → Run Environment (after opening your project)

Then you can add or remove any environment variables that you would like, including LD_LIBRARY_PATHOne thing that I'm not sure about is if you can substitute, for example. the build path to the value of these variables, so you don’t need to hardcode this into yours LD_LIBRARY_PATH.

- script , , " ", script. .

+5

qt- QTCreator Linux-. , .pro :

unix:LIBS += -L/home/projects/my_libs/ -lmy_lib

unix:{
  QMAKE_LFLAGS += -Wl,--rpath=/home/projects/my_libs/
  QMAKE_LFLAGS_RPATH=
}

rpath : rpath

, ,

+6

Just using this:

unix:LIBS += -L/home/projects/my_libs/ -lmy_lib
unix:{
  QMAKE_LFLAGS += -Wl,--rpath=/home/projects/my_libs/
}

This is also a problem.

+1
source

Source: https://habr.com/ru/post/1784278/


All Articles