How can I work out the cause of code generation errors in simulink when using the "Import Custom Code" feature?
33 views (last 30 days)
I am trying to build a model which contains a C-Function block using a simple c library (just one header and source file).
However almost any time i make any changes to the header and source and then to the block i get a very unhelpful error message telling me to simply "Fix the errors in your custom code" .
The full error message is this:
Top model targets built:
Model Action Rebuild Reason
ICCPD_Model Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 2.98s
Error(s) encountered while building custom code simulation target for model 'ICCPD_Model'. Fix the errors in your custom code or disable 'Import custom code' if your custom code has incompatibilities.
Microsoft (R) Manifest Tool
Copyright (c) Microsoft Corporation.
All rights reserved.
mt : general error c101008d: Failed to write the updated manifest to the resource of file "D:\Dropbox\EV Parts\Laptop Code\C++\IC_CPD\EVP_ICCPD_Comms\Demonstrator\ICCCPD_Firmware\Simulink\slprj\_slcc\mOGuHBhlPeYuKKXBoKvpv\mOGuHBhlPeYuKKXBoKvpv_cclib.dll". The system cannot open the device or file specified.
While i am sure that there is an error somewhere that is causing this, i have no idea how to use this message to find the cause.
I am currently only working with only one C Function block with a very simple function so I at least know which block is causing this error, even though it does not mention the block name. But i plan to make my model a lot more complex and will no doubt have bugs along the way which retrigger this problem. But then it will be even harder to diagnose.
Could someone please explain what this error means, i dont know what the file that cant be opened is or what its relevance to my code is?
Is there a way to perhaps access more detailed build logs for the embedded code generation process?
Puru Kathuria on 8 Mar 2021
As far as i can read the error message, it is because of the following reasons:
dll files are mandatory after you have generated the code and if you want to run your code on other platforms like C/C++.
And your error states that they are not able to access the dll files.
It can be because of two reasons:
Either the files are read only or they are generated in some other source folders.
But since you were able to access it after restarting that means that they were generated in the same folder and the permissions to access it changed after restarting MATLAB.