Can't solve linker error in building S-Function Builder




Answers (1)
0 votes
11 Comments
This is very likely because you have only declared these variables but not defined them. You should search for some C++ tutorials about declarations and definitions .
- Add some reporter code of observable by-effects before potential buggy lines. For example, print some text, write some files, etc. If you can observe a specific by-effect after running the module, you know the crashing line must be after that reporter code, and vice versa. Repeat reporting and you'll finally locate the exact crashing line.
- Build an individual debugging environment with a professional IDE such as Visual Studio. Configure a serious project to build with VS under Debug configuration and produce symbol files. Then attach VS to MATLAB so that you can pause and step C++ code running by adding breakpoints in VS at any code lines, just like you pause and step MATLAB code in the MATLAB code editor.
Very unlikely that the problem is not in your C++ code, as verified by yourself. Python is designed to be memory-safe (cost a certain performance overhead), i.e., you shall be an expert to have python code access invalid memory. This is just the opposite against C++, where you shall be an expert not to access invalid memory.
It's also a good way to comment out some code as you did to exclude unrelated considerations. You may continue to comment out more lines (even all lines except for those required for successful compilation) until something different happens. Pure revision is often of little help.
Categories
Find more on Data Exchange and Mapping with C++ Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




