I couldn't compile my c code with the shared library generated by matlab from m files. How can I resolve this?
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Compile option
""" gcc -O3 -I/usr/local/MATLAB/MATLAB_Compiler_Runtime/v83/extern/include/ -L/usr/local/MATLAB/MATLAB_Compiler_Runtime/v83/extern/lib/glnxa64/ -L/for_testing -ltest main.c -o main
/tmp/ccip5bsu.o:
In function `main':
main.c:(.text.startup+0xa6): undefined reference to `mxCreateDoubleMatrix_730_proxy'
main.c:(.text.startup+0xba): undefined reference to `mxCreateDoubleMatrix_730_proxy'
main.c:(.text.startup+0xc5): undefined reference to `mxGetPr_proxy'
main.c:(.text.startup+0x125): undefined reference to `mxGetPr_proxy'
main.c:(.text.startup+0x1a9): undefined reference to `mlxMyMult'
main.c:(.text.startup+0x1b3): undefined reference to `mxGetPr_proxy'
collect2: error: ld returned 1 exit status
make: *** [main] Error 1
0 Commenti
Risposte (2)
Philip Caplan
il 14 Apr 2015
This looks like a linker error where the implementations of "mxCreateDoubleMatrix", "mxGetPr", etc. were not found. Is the command you posted complete? I see the path was specified but the only library linked against was "test". Please try adding "-lmx -lmclmcrrt" at the end of your compiling command.
If that does not help, please provide some more details about your operating system and MATLAB version.
1 Commento
K R S Nandhan
il 23 Mar 2021
I have similar error but my code is in c++.
g++ -g -o main main.cpp
/usr/bin/ld: /tmp/ccn43UqG.o: in function `rt_atan2d_snf(double, double)':
/home/nandhan/games/test/rcamcoder.cpp:32: undefined reference to `rtNaN'
/usr/bin/ld: /tmp/ccn43UqG.o: in function `rt_powd_snf(double, double)':
/home/nandhan/games/test/rcamcoder.cpp:70: undefined reference to `rtNaN'
/usr/bin/ld: /home/nandhan/games/test/rcamcoder.cpp:81: undefined reference to `rtInf'
/usr/bin/ld: /home/nandhan/games/test/rcamcoder.cpp:88: undefined reference to `rtInf'
/usr/bin/ld: /home/nandhan/games/test/rcamcoder.cpp:103: undefined reference to `rtNaN'
collect2: error: ld returned 1 exit status
Vedere anche
Categorie
Scopri di più su Big Data Processing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!