Skip to main content
1 of 2

g++: error: ldd: No such file or directory compiling Matlab matcreat.cpp under eclipse IDE

I am trying to compile matcreat.cpp under Eclipse C++ IDE. It allows to exchange matlab data with c++ programs. At some point Matlab propose to enter the command "ldd -d libmat.so" and send it to the compiler so I go to Project>>properties>>C/C++ Build/GCC C++ Compiler and I add the sentence in miscellaneaous/other flags. I get the following compilation error:

16:47:43 **** Incremental Build of configuration Debug for project essai ****
make all 
Building file: ../matcreat.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/MATLAB/R2020b/extern/include -O0 -g3 -Wall -c -fmessage-length=0  ldd -d  libmat.so -MMD -MP -MF"matcreat.d" -MT"matcreat.o" -o "matcreat.o" "../matcreat.cpp"
g++: erreur: ldd: Aucun fichier ou dossier de ce type
g++: erreur: argument manquant à « -d »
g++: erreur: libmat.so: Aucun fichier ou dossier de ce type
make: *** [subdir.mk:20 : matcreat.o] Erreur 1
"make all" terminated with exit code 2. Build might be incomplete. error

So first question: is the compiler failing to find ldd or is ldd failing to find the library?

I suppose it is the second case. I write "ldd -d libmat.so" in a terminal without any answer. I write "ldd -d /usr/local/MATLAB/R2020b/bin/glnxa64/libmat.so" and it works.

Then I try to enter the file path in /etc/ld.so.conf but ldd still refuse to find libmat.so even after reboot if I don't write the path.

Finally I change the command in Eclipse to be "ldd -d /usr/local/MATLAB/R2020b/bin/glnxa64/libmat.so" but it has no effect.

Any idea?

Thanks in advance

B