MATLAB Answers

Add Library to default toolchain

2 views (last 30 days)
Constantin Wiesener
Constantin Wiesener on 26 Jan 2020
I am using ert code generation and would like to add a custom library for linking during building.
But i can only add options. Adding libraries is not possible. It will always be added before the -o files. Actually I want to add the pthread library for linux project
but I am getting an undefined reference:
Version:1.0 StartHTML:0000000100 EndHTML:0000004363 StartFragment:0000000100 EndFragment:0000004363
I/opt/MATLAB/R2017b/extern/include -I/opt/MATLAB/R2017b/simulink/include -I/opt/MATLAB/R2017b/rtw/c/src -I/opt/MATLAB/R2017b/rtw/c/src/ext_mode/common -I/opt/MATLAB/R2017b/rtw/c/ert -I/opt/MATLAB/R2017b/rtw/c/src/rtiostream/rtiostreamtcpip -I/opt/MATLAB/R2017b/toolbox/coder/rtiostream/src/utils -o "ert_main.o" "ert_main.cpp" In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:0, from /usr/include/stdio.h:27, from ert_main.cpp:19:
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" ^~~~~~~ ### Creating standalone executable ../test ... g++ -Wl,-rpath,"/opt/MATLAB/R2017b/bin/glnxa64",-L"/opt/MATLAB/R2017b/bin/glnxa64" -o ../test test.o test_data.o ext_svr.o updown.o ext_work.o rtiostream_interface.o rtiostream_tcpip.o rtiostream_utils.o ert_main.o -lm ert_main.o: In function `sub_rate2(void*)': ert_main.cpp:(.text+0x67): undefined reference to `sem_wait' ert_main.cpp:(.text+0x7c): undefined reference to `sem_wait' ert_main.o: In function `sub_rate3(void*)':
As I understood a Makefile is generatd which only gives the -lm as a library linking option. Which makefile I have to change?


Sign in to comment.

Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by