Why do I get "undefined reference to variable" and "ld returned 1 exit status" when using custom code in my Simulink model?
I have a Simulink model with custom code mappings. I have configured the code mappings to use an imported header file that contains definitions for all of my custom variables. These variables are defined in a corresponding C file, and both files are added to the "Include Directories" section under the Configuration Parameters "Custom Code" tab.
I can generate code without issue, but if I try to build with the "Generate code only" (GenCodeOnly) option disabled, or run the model in a harness like Simulink Test, I get errors that look like this:
file.c:(.segment.table[varname]): undefined reference to `varname'
...
collect2: error: ld returned 1 exit status
project.mk:123: recipe for target 'project' failed
make: *** [project] Error 1
Why is this happening, and how do I fix these errors?
采纳的回答
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!