MATLAB Coder global variable error

5 visualizzazioni (ultimi 30 giorni)
Florian Morsch
Florian Morsch il 29 Giu 2018
Commentato: Adam il 29 Giu 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 Commenti
Florian Morsch
Florian Morsch il 29 Giu 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 il 29 Giu 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.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by