MATLAB C Coder exports times function which conflicts with MacOSX12 SDK's times function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
William Grand
le 20 Juin 2022
Modifié(e) : Sumit Ghosh
le 22 Juin 2022
When we export our MATLAB files to C, they export times.h which contains a function with the same name, called times. Therefore, when I attempt to compile the exported C code in my iPhone app using clang, the function conflicts with the macOS SDK version of times (see the log below). How can I avoid this conflict?
Thank you,
William
Showing All Messages
CompileC /Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/Objects-normal/x86_64/getCroppedTaggedMeasures.o /Users/wgrand/Code/DriveEventClassifier/Normalization/buildDataSet_pkg/getCroppedTaggedMeasures.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'DriveEventClassifier' from project 'DriveEventClassifier')
cd /Users/wgrand/Code/DriveEventClassifier
export LANG\=en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-macos12.3 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu11 -fmodules -gmodules -fmodules-cache-path\=/Users/wgrand/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/wgrand/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -fmodule-name\=DriveEventClassifier -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Wquoted-include-in-framework-header -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DDEBUG\=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -index-store-path /Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Index/DataStore -iquote /Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/DriveEventClassifier-generated-files.hmap -I/Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/DriveEventClassifier-own-target-headers.hmap -I/Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/DriveEventClassifier-all-non-framework-target-headers.hmap -ivfsoverlay /Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/all-product-headers.yaml -iquote /Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/DriveEventClassifier-project-headers.hmap -I/Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Products/Debug/include -I/Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/DerivedSources-normal/x86_64 -I/Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/DerivedSources/x86_64 -I/Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/DerivedSources -F/Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Products/Debug -MMD -MT dependencies -MF /Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/Objects-normal/x86_64/getCroppedTaggedMeasures.d --serialize-diagnostics /Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/Objects-normal/x86_64/getCroppedTaggedMeasures.dia -c /Users/wgrand/Code/DriveEventClassifier/Normalization/buildDataSet_pkg/getCroppedTaggedMeasures.c -o /Users/wgrand/Library/Developer/Xcode/DerivedData/DriveEventClassifier-dwrnpjnmsfzkcedtalacvhatvvty/Build/Intermediates.noindex/DriveEventClassifier.build/Debug/DriveEventClassifier.build/Objects-normal/x86_64/getCroppedTaggedMeasures.o -index-unit-output-path /DriveEventClassifier.build/Debug/DriveEventClassifier.build/Objects-normal/x86_64/getCroppedTaggedMeasures.o
In file included from /Users/wgrand/Code/DriveEventClassifier/Normalization/buildDataSet_pkg/getCroppedTaggedMeasures.c:14:
/Users/wgrand/Code/DriveEventClassifier/Normalization/buildDataSet_pkg/eml_i64dmul.h:21:11: error: conflicting types for 'times'
long long times(long long x);
^
In module 'Darwin' imported from /Users/wgrand/Code/DriveEventClassifier/Normalization/buildDataSet_pkg/tmwtypes.h:32:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/sys/times.h:90:9: note: previous declaration is here
clock_t times(struct tms *);
^
In file included from /Users/wgrand/Code/DriveEventClassifier/Normalization/buildDataSet_pkg/getCroppedTaggedMeasures.c:15:
/Users/wgrand/Code/DriveEventClassifier/Normalization/buildDataSet_pkg/rt_nonfinite.h:46:29: warning: this function declaration is not a prototype [-Wstrict-prototypes]
extern void rt_InitInfAndNaN();
^
void
1 warning and 1 error generated.
0 commentaires
Réponse acceptée
Sumit Ghosh
le 22 Juin 2022
Modifié(e) : Sumit Ghosh
le 22 Juin 2022
The configuration parameter ReservedNameArray in coder.EmbeddedCodeConfig object can be used to specify names that the code generator must not use for functions or variables, specified as a string arrays, cell array of character vectors, or character vector.
Also, if there are issues with a file named times.c/h, the configuration parameter CustomFileNameStr in coder.EmbeddedCodeConfig can be used to mangle generated file names.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur MATLAB Coder dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!