MATLAB Answers

MATLAB Coder global variable error

조회 수: 10(최근 30일)
Florian Morsch
Florian Morsch 29 Jun 2018
댓글: Adam 29 Jun 2018
Im trying to use the MATLAB coder to generate code from my function.
When i check for errors, i get a "Could not find initial value for global variable 'AllMyDifferentVariables' " on every global variable i assigned.
But as you can see, i set the global variable and assign a value (empty) to each.
Could someone help me to figure out why it says they have no value even if they have?
Even if there is a nonempty variable it gives the error (see IsFound = false; , but still no initial value??? )
EDIT: After i changed the variables again ( not global anymore, strangely the other error i had before without global variables is gone now...) i have a new error:
The library method 'vision.internal.buildable.cascadeClassifierBuildable.updateBuildInfo' failed.
Caused by: ********************************************** Generated code from your project uses OpenCV and requires that you use a supported C++ compiler. Use 'mex -setup' to select a href="https://www.mathworks.com/help/vision/ug/portable-c-code-generation-for-functions-that-use-opencv-library.html">supported</a C++ compiler. **********************************************
Right now im using Visual Studio 2017, do i really have to use VS 2015?

  댓글 수: 3

Rik
Rik 29 Jun 2018
Why do you need global variables in the first place?
Florian Morsch
Florian Morsch 29 Jun 2018
Because i had a error before which was suggested to solve by declaring the variables as global. After i did so the error was gone, i fixed some other stuff and now this error appeared.
Adam
Adam 29 Jun 2018
I would suggest that whatever the original problem was could be far better solved in other ways than using global variables which introduce myriad problems of their own (e.g. like this) which makes them not a good solution for any problem.

로그인 to comment.

답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by