coin-or / qpOASES

Open-source C++ implementation of the recently proposed online active set strategy
GNU Lesser General Public License v2.1
360 stars 121 forks source link

undefined reference to qpOASES::QProblem::QProblem(int, int, qpOASES::HessianType, qpOASES::BooleanType) and  qpOASES::Qproblem::init(…) #107

Closed ghost closed 3 years ago

ghost commented 3 years ago

Version : qpOASES-3.2.1 I am trying to use QPOASES in a C++ program. I followed the installation process for the linux operating system. I define my compilation paths such as :

[…]
QPOASES_LIB_PATH := [my_path]/qpOASES/bin
QPOASES_INCLUDE_PATH := [my_path]/qpOASES/include
LIBS = -lilocplex -lconcert -lcplex -lm -lpthread -ldl -lopenblas -larmadillo -lqpOASES
//
[…]
g++ -s -L$(CPLEX_LIB_PATH) -L$(CONCERT_LIB_PATH) -L$(ARMA_LIB_PATH) -L$(QPOASES_LIB_PATH)  -o"bb_cpp" $(BB_CPP_OBJS) $(DLIB_OBJS) $(LIBS)
[…]
    $(CXX) -DIL_STD -I$(CPLEX_INCLUDE_PATH) -I$(CONCERT_INCLUDE_PATH) -I$(ARMA_INCLUDE_PATH) -I$(QPOASES_INCLUDE_PATH)  -I../dlib -O3 -c -o $@ $<
[…]

I model my linear constrained quadratic problem according to the example n°1. When I try to run make , I get the following errors :

UB.cpp:(.text.unlikely+0x3a8e) : référence indéfinie vers « qpOASES::QProblem::QProblem(int, int, qpOASES::HessianType, qpOASES::BooleanType) »

/usr/bin/ld : UB.cpp:(.text.unlikely+0x3ade) : référence indéfinie vers « qpOASES::QProblem::init(double const*, double const*, double const*, double const*, double const*, double const*, double const*, int&, double*, double const*, double const*, qpOASES::Bounds const*, qpOASES::Constraints const*, double const*) »

I tried to follow the advice of a previous issue by adding in my compilation command :

$(CXX) -DIL_STD […] -I$(ARMA_INCLUDE_PATH) -I ../include -D__USE_LONG_INTEGERS__   -I$(QPOASES_INCLUDE_PATH) [...]

And the result :

/build/bb_cpp: error while loading shared libraries: libqpOASES.so: cannot open shared object file: No such file or directory

Any idea ? Thx a lot ! Regards.

apotschka commented 3 years ago

Hi Mehdi,

it looks to me like your linker is happy now.

However, the runtime loader cannot find the file libqpOASES.so. Does adding the respective path to LD_LIBRARY_PATH work?

Best wishes, Andreas

ghost commented 3 years ago

Hi Mehdi,

it looks to me like your linker is happy now.

However, the runtime loader cannot find the file libqpOASES.so. Does adding the respective path to LD_LIBRARY_PATH work?

Best wishes, Andreas

My fault, my mind was elsewhere. The problem is solved! I hadn't considered this possibility. Thank you for your answer! A+, M.