PDA

View Full Version : QProcess on linux - problem with shared libraries



michallen
29th October 2010, 17:06
Hi. I`ve written this code :


QProcess *myProcess = new QProcess();

QProcessEnvironment env = QProcessEnvironment::systemEnvironment();

env.insert("LD_LIBRARY_PATH", "/home/khoros2200/lib");

myProcess->setProcessEnvironment(env);

myProcess->execute("/home/khoros2200/bin/karith1");

and i have this error :

/home/khoros2200/bin/karith1: error while loading shared libraries: libkdmanip.so: cannot open shared object file: No such file or directory

when I execute the program in console , it works properly . When I unset the LD_LIBRARY_PATH variable I get the same mistake as in Qt Creator. So what`s the problem ? Why is QProcess doesn`t see envioronment variables ?

wysota
31st October 2010, 09:47
QProcess::execute() is a static call so it ignores whatever you do with the QProcess object. Use QProcess::start() instead.