How to instruct a programme to use a locally installed libra

OpenFOAM is a CFD programme (Open Source) that I wish I could run on my OpenSUSE11.1 partition. The problem is that it uses an old version of qt (lower than the installed version).
I downloaded this old version and installed it in a subfolder to the OpenFOAM folder.
Now how could I instruct OpenFOAM to look for that subfolder and not the system qt folder.
Any help would be highly appreciated

From man ld:

The linker uses the following search paths to locate required shared libraries:

1.  Any directories specified by -rpath-link options.

2.  Any directories specified by -rpath options.  The difference between -rpath
    and -rpath-link  is  that  directories  specified  by  -rpath  options  are
    included  in  the  executable  and used at runtime, whereas the -rpath-link
    option is only effective at link time. Searching -rpath in this way is only
    supported  by  native  linkers and cross linkers which have been configured
    with the --with-sysroot option.

3.  On an ELF system, for native linkers, if the -rpath and -rpath-link options
    were   not   used,   search   the  contents  of  the  environment  variable
    "LD_RUN_PATH".

4.  On SunOS, if the -rpath option was not used, search any directories  speci-
    fied using -L options.

5.  For  a  native  linker, the search the contents of the environment variable
    "LD_LIBRARY_PATH".

6.  For a native ELF linker, the directories in "DT_RUNPATH" or "DT_RPATH" of a
    shared  library  are  searched  for  shared  libraries  needed  by  it. The
    "DT_RPATH" entries are ignored if "DT_RUNPATH" entries exist.

7.  The default directories, normally /lib and /usr/lib.

8.  For a native linker on an ELF system, if the file  /etc/ld.so.conf  exists,
    the list of directories found in that file.

So, set LD_LIBRARY_PATH to the “subfolder to the OpenFOAM folder”.

Thanks a lot for your reply.According to your recommendation, the problem would be solved if I insert the following two lines in a script that I use to run the programme,

QT=/home/XXXXX/OpenFOAM/ThirdParty/QT-4.3.5
export LD_LIBRARY_PATH=$QT/lib:$LD_LIBRARY_PATH

sorry if I repeat, but my knowledge and expertise are not in the IT field.

Once again, I appreciate your help

Yes.

But 4.3.5 is the “old” version?? I don’t know QT so well, but any program compiled against 4.3.5 should work with the 4.4.3 from openSUSE 11.1.

Thanks a lot for your reply.
The export LD_LIBRARY_PATH=$QT/lib:$LD_LIBRARY_PATH seems to not like the declared QT variable and does not update the value of LD_LIBRARY_PATH, so I rewrote it explicitly as follows
export LD_LIBRARY_PATH=/home/XXXXX/OpenFOAM/ThirdParty/QT-4.3.5/lib:$LD_LIBRARY_PATH
Now it works and everything is fine. Thank you.
FYI
OpenFoam uses another open source programme (ParaView) to visualize the results of computations. The version of ParaView included with OpenFoam does not run with the installed qt (the 4.4.x), it needs that specific (4.3.x) old version to run. And that is the reason I have to go through this odd procedure.
Any way, I am happy that OpenFOAM is running OK.