snopt / snopt-interface

C/C++ API for SNOPT7
MIT License
27 stars 12 forks source link

libsnopt7_cpp has undefined references #30

Closed gabstank closed 4 years ago

gabstank commented 4 years ago

Hello, I am trying to compile a simple example using c++ interface. I used the code from sntoya example. I did following steps during installation:

export FC=/usr/bin/gfortran-7 ~/Solvers/snopt7$ ./configure --prefix=/calculate/gabriel/Solvers/snopt --with-matlab=/opt/MATLAB/R2018b/bin --with-blas="-L/usr/lib/x86_64-linux-gnu -lblas" --with-c-cpp --with-pic make make install

Then I compiled the example (which is just a single main.cpp file with sntoya code) using: g++ -O -I/calculate/gabriel/Solvers/snopt/include -c main.cpp -o main.o g++ -O main.o -o main -L/calculate/gabriel/Solvers/snopt/lib -lsnopt7_cpp

The error I get are around 30 undefined references of the type: /calculate/gabriel/Solvers/snopt/lib/libsnopt7_cpp.so: undefined reference tosnkerc_'`

I checked the installation with make check - it works properly. However this happens anyways. What am I doing wrong?

Thanks in advance, Gabriel

gabstank commented 4 years ago

Btw. I have also defined the LD_LIBRARY_PATH to the lib directory.

gnowzil commented 4 years ago

You need to get access to the main Fortran SNOPT library. This package is only the C/C++ wrapper interface for SNOPT.