Thank you guys answering my previous problem on undefined reference to function. As you suggested, the reason under the problem is not linking the libraries. Now I have generated the executable file with: (the version of my g++ and gcc is 4.4.5. I am using Ubuntu 10.10.)
g++ -o ex_addinst ./ex_addinst.o -L/home/li/work/tools/lindo/lindoapi/bin/linux64 -m64 -llindo64 -lmosek64 -lconsub3 -lc -ldl -lm -lguide -lpthread -lsvml -limf -lirc
But there comes another problem, when I run the executable file with
./ex_addinst
errors appear: (I am not sure I should start a new problem or not currently....)
./ex_addinst: error while loading shared libraries: liblindo64.so.6.0: cannot open shared object file: No such file or directory
But liblindo64.so.6.0 exists in the folder of the lib ~/lindoapi/bin/linux64 which contains following files:
libconsub3.so libirc.so liblindojni.so libmosek64.so.5.0 lindo.par
libguide.so liblindo64.so liblindojni.so.6.0.3 libsvml.so placeholder
libimf.so liblindo64.so.6.0 libmosek64.so lindoapivars.sh runlindo
I have created a symbolic link between liblindo.so.6.0 and liblindo.so:
ln -sf liblindo64.so.6.0 liblindo64.so
There is '-llindo64' is the g++ command, so I thought liblindo64.so.6.0 should have been linked. I have tried to change -L to -Llib, but doesn't help.
Can anyone tell me what is wrong here? Thanks!