- Combine your MATLAB functions into a single script or function that MATLAB Coder can process as one. This approach ensures that utility functions are generated only once.
- Since you are using MATLAB Coder to generate code for multiple functions separately, specify a shared utility code location. This tells MATLAB Coder to place shared utility functions in a common location, preventing duplicate definitions.]
Matlab coder generated two different c code functions when used together in a project shows Linker command error
7 views (last 30 days)
Show older comments
I am using matlab coder to create c code.
I created two functions. When these two functions I try to use together in c program it gives compiler error as below.
Has anybody any idea how to use these two functions without such clash.
_beats/*.c detect_beats/detect_beats_wo_bandpass/*c -o ans
duplicate symbol '_rtIsInf' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-44c1f7.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-05eeea.o
duplicate symbol '_rtMinusInf' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-44c1f7.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-05eeea.o
duplicate symbol '_rtGetNaN' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetNaN-f473a5.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetNaN-ae8b58.o
duplicate symbol '_rtNaN' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-44c1f7.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-05eeea.o
duplicate symbol '_rtIsInfF' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-44c1f7.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-05eeea.o
duplicate symbol '_emxInit_real_T' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/butter_bandpass_filter_emxutil-070d39.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/detect_beats_wo_bandpass_emxutil-6a1468.o
duplicate symbol '_emxFree_int8_T' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/butter_bandpass_filter_emxutil-070d39.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/detect_beats_wo_bandpass_emxutil-6a1468.o
duplicate symbol '_emxInit_int8_T' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/butter_bandpass_filter_emxutil-070d39.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/detect_beats_wo_bandpass_emxutil-6a1468.o
duplicate symbol '_rtMinusInfF' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-44c1f7.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-05eeea.o
duplicate symbol '_emxEnsureCapacity_int8_T' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/butter_bandpass_filter_emxutil-070d39.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/detect_beats_wo_bandpass_emxutil-6a1468.o
duplicate symbol '_emxFree_real_T' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/butter_bandpass_filter_emxutil-070d39.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/detect_beats_wo_bandpass_emxutil-6a1468.o
duplicate symbol '_rtGetInf' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetInf-26efbf.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetInf-05b636.o
duplicate symbol '_rtGetInfF' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetInf-26efbf.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetInf-05b636.o
duplicate symbol '_rtInfF' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-44c1f7.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-05eeea.o
duplicate symbol '_rtGetMinusInfF' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetInf-26efbf.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetInf-05b636.o
duplicate symbol '_rtIsNaNF' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-44c1f7.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-05eeea.o
duplicate symbol '_emxEnsureCapacity_real_T' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/butter_bandpass_filter_emxutil-070d39.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/detect_beats_wo_bandpass_emxutil-6a1468.o
duplicate symbol '_rtIsNaN' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-44c1f7.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-05eeea.o
duplicate symbol '_rtGetMinusInf' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetInf-26efbf.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetInf-05b636.o
duplicate symbol '_rtGetNaNF' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetNaN-f473a5.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rtGetNaN-ae8b58.o
duplicate symbol '_rtNaNF' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-44c1f7.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-05eeea.o
duplicate symbol '_rtInf' in:
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-44c1f7.o
/private/var/folders/3_/j2r6k5_n3gn_dx4hjk93hls40000gn/T/rt_nonfinite-05eeea.o
ld: 22 duplicate symbols
clang: error: linker command failed with exit code 1 (use -v to see invocation)
0 Comments
Answers (1)
Ayush Singh
on 13 May 2024
Hi Amul
As i can see by the look of the error log shared by you I think it is due to duplicate symbols being defined in multiple object files generated by MATLAB Coder.
This usually happens when the same utility functions are included in different parts of the code that you are trying to compile together.
Try the following as workarounds to see if your issue gets resolved:
You can visit the following link for second point mentioned above:
Hope it helps!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!