Why do I get this #include "math.h" error in Vehicle Dynamics Blockset

42 ビュー (過去 30 日間)
N1XKP
N1XKP 2024 年 11 月 8 日 11:55
回答済み: Abhishek Kumar Singh 2024 年 11 月 8 日 15:26
Hello,
I'm new to using the Vehicle Dynamics Blockset, and I'm following the Configure Virtual Vehicle Setup Guide. However, whenever I attempt to run the scenario, I encounter the following error message:
### Searching for referenced models in model 'ConfiguredVirtualVehicleModel'.
### Found 12 model reference targets to update.
### Starting serial model reference simulation build.
Please download a supported version of Xcode at /Applications/MATLAB_R2024b.app/rtw/c/tools/macsdkver.pl line 27.
xcrun clang -arch arm64 -isysroot /Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=12.0 -c -fno-common -fexceptions -fwrapv -ffp-contract=off -DNRT -DIS_SIM_TARGET -O0 -DMODEL=rtwshared -DNUMST= -DNCSTATES=0 -DUNIX -DMAT_FILE=0 -DINTEGER_CODE=0 -DONESTEPFCN=1 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DMT=0 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS= -I. -I../../.. -I/Users/panagiotiskatoikos/Library/Mobile\ Documents/com~apple~CloudDocs/NTUA/Εργασίες\ /Εξάμηνο\ 9/Υβριδικά\ -\ Ηλεκτρικά\ Οχήματα/Test\ V/VirtualVehicle/VirtualVehicle/Work -I/Users/panagiotiskatoikos/Library/Mobile\ Documents/com~apple~CloudDocs/NTUA/Εργασίες\ /Εξάμηνο\ 9/Υβριδικά\ -\ Ηλεκτρικά\ Οχήματα/Test\ V/VirtualVehicle/VirtualVehicle/Work/slprj/sim/_sharedutils -I/Applications/MATLAB_R2024b.app/extern/include -I/Applications/MATLAB_R2024b.app/simulink/include -I/Applications/MATLAB_R2024b.app/rtw/c/src -I/Applications/MATLAB_R2024b.app/rtw/c/src/ext_mode/common -I/Applications/MATLAB_R2024b.app/rtw/c/ert "rt_nonfinite.c"
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
rt_nonfinite.c:3:10: fatal error: 'math.h' file not found
3 | #include "math.h"
| ^~~~~~~~
1 error generated.
gmake: *** [rt_nonfinite.o] Error 1
### Build procedure for BMSBalancingLogic aborted due to an error.
Build Summary
Model reference simulation targets:
Model Build Reason Status Build Duration
=================================================================================================================================================
BMSBalancingLogic Target (BMSBalancingLogic_msf.mexmaca64) did not exist. Failed to build. For more information, see build log. 0d
0 of 12 models built (0 models already up to date)
Build duration: 0h 0m 26.336s
Warning: Error occurred while executing the listener callback for event RequestToRunSimulation defined for class VirtualAssembly.VirtualToolstrip:
Error using TestScript (line 9)
Unable to update models referenced by 'ConfiguredVirtualVehicleModel'.
Error in VirtualAssembly.VirtualView/runSimulation
Error in VirtualAssembly.VirtualView
Error in VirtualAssembly.VirtualToolstrip
Error in internal.Callback.execute (line 128)
feval(callback, src, event);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in matlab.ui.internal.toolstrip.base.Action/PeerEventCallback (line 852)
internal.Callback.execute(this.PushPerformedFcn, this, eventdata);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in matlab.ui.internal.toolstrip.base.ActionInterface>@(event,data)PeerEventCallback(this,event,data) (line 41)
this.PeerEventListener = addlistener(this.Peer, 'peerEvent', @(event, data) PeerEventCallback(this, event, data));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event))
(line 76)
proxyCallback = @(src, event)callback(src, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Show complete stack trace
Caused by:
Error using indexing
Error(s) encountered while building "rtwshared" - Show complete stack trace
> In VirtualAssembly.VirtualToolstrip
In internal.Callback.execute (line 128)
In matlab.ui.internal.toolstrip.base/Action/PeerEventCallback (line 852)
In matlab.ui.internal.toolstrip.base.ActionInterface>@(event,data)PeerEventCallback(this,event,data) (line 41)
In viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 76)
>>
I’ve tried uninstalling and reinstalling Xcode, but this hasn't resolved the issue, and I can’t find anyone with a similar problem either.
Are there any suggestions?
Thank you!

採用された回答

Abhishek Kumar Singh
Abhishek Kumar Singh 2024 年 11 月 8 日 15:26
Hi @N1XKP,
The error mentions that math.h is not found. This usually means the SDK path is incorrect or incomplete. Ensure that the SDK path set in your environment is correct. You can check and set it in your terminal:
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
It also suggests that you might not have a supported version of Xcode. Could you please verify this for your MATLAB release using this portal? https://www.mathworks.com/support/requirements/supported-compilers-mac.html
If none of the above works, you can manually find and add the math.h file by opening the Model Configuration Parameters. To do this, go to the Modeling tab and look in the Setup section, or simply press Ctrl+E. For more details, check out this documentation link: Include headers - MATLAB & Simulink

その他の回答 (0 件)

タグ

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by