Jump to content

Shared variables break vis on startup

Recommended Posts


I am using shared variables to pass messages across a network. Every time I open my project my vis are broken due to this error: "LabVIEW could not generate code for the shared variable. You must open the VI in the project that contains the library where the shared variable resides." The only way I have found to fix this error is to double click on all the shared variables on my block diagram, after which the error goes away. What's going on, and how do I stop this from happening?



Link to comment

Tom, I think I encountered the very same problem recently (depended on whether RT FIFOs were enabled or disabled, if I remember correctly). (Hopefully I'm not confusing two issues. It's possible. Let us know if the solutions below work.)

NI support found the problem (and workarounds):

Cause: "a race condition where the variable attempts to transmit an initial value before the read subscription to the variable has been fully established. This puts the variable in a bad state and causes an invalid error condition to be set."


"[F]orce a read of the variable before writing an initial value to the variable."

"gnore this error if it is returned by the first read of the shared variable. The error condition will be cleared once the variable subscription succeeds, and variable communication should function normally from that point on."

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.