Hi. I am trying to link against a library that calls functions in another library (in this case, coinor-symphony, the a mixed integer linear programming solver). However, I keep running into an undefined symbols error. Mysteriously, it works when I directly compile the object files together, rather than build a library anbd link against that library.
A small test case is here: http://www.ee.iitb.ac.in/~akumar/dump/libtest.tar.gz Here is what you get if you run make: gcc -Wall -fopenmp -c -o milp.o milp.c gcc -Wall -fopenmp -fPIC -c -o symtest.o symtest.c -I/usr/include/coin gcc -Wall -fPIC -fopenmp -shared -Wl,--rpath -Wl,/usr/lib -o libsymtest.so symtest.o `pkg-config --libs symphony` g++ -Wall -fopenmp -o milp milp.o `pkg-config --libs symphony` -L. -lsymtest ./libsymtest.so: undefined reference to `sym_parse_command_line' ./libsymtest.so: undefined reference to `sym_close_environment' ./libsymtest.so: undefined reference to `sym_load_problem' ./libsymtest.so: undefined reference to `sym_solve' ./libsymtest.so: undefined reference to `sym_open_environment' collect2: error: ld returned 1 exit status Makefile:4: recipe for target 'milp' failed make: *** [milp] Error 1 But if I try to do this, I can compile and run things: g++ -c `pkg-config --cflags symphony` milp.c g++ -c `pkg-config --cflags symphony` symtest.c g++ -fopenmp milp.o symtest.o -o milp `pkg-config --libs symphony` things work perfectly. Could you please point out what I am missing? And this problem seems to occur only with the symphony libraries; linking against other libraries (notably ones that don't require fopenmp) seem to go through fine. Thanks. Kumar -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: https://lists.debian.org/[email protected]

