Missing reference - JuMP variables

I’m using JuMP in vscode, and I add JuMP as

using JuMP

at the beginning of my code, and I define many variables like

@variable(hNet, injectionTemp[1:SCHTIME])
@variable(hNet, inletTemp[1:nNode, 1:SCHTIME])

while it gives me a problem that the variables, i.e., injectionTemp, inletTemp, etc. are missing reference, but, the code can be executed actually, so, what’s the real problem?

Can you be more specific about what this means? Can you provide any error messages?

Just like the picture shows above.

I use the latest JuMP, and I turn off the Missingrefs suggested from https://discourse.julialang.org/t/missing-reference-warnings-with-julia-in-vs-code/31321/7

And the problem is solved. Variables defined in the above method do not have code hint. :joy:

Indeed, the @variable macro creates the reference to the variable name when it is called, so you wouldn’t expect it to be a registered symbol beforehand.

1 Like