Jump to content

VEX array of structs


demian

Recommended Posts

Hello,

I'm a newbie with vex and I'm trying to create an array of structs. In my wrangle node I defined the struct in the outer code section as suggested here

my struct looks like this:

struct node {

    int pt;

    int nbrs[ ];

}

 

In my code I later declare

node nd;

node array[ ];

I manage to initialise the nd variable normally. Then I tried the following

  1. int pt = nd.pt; //works fine
  2. int nbrs[] = nd.nbrs; //works fine
  3.  
  4. array[0] = nd; //seems to work fine
  5. pt = array[0].pt; //nope
  6. nd = array[0]; //nope
 
By doesn't work I mean that the node turns red saying the following

Error

The sub-network output operator failed to cook: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1

Warning: Errors or warnings encountered during VEX compile:

/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1).

Errors or warnings encountered during VEX compile:


/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1).

Error: Vex error:
/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1)

Failed to resolve VEX code op:
/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1

Unable to load shader 'op:/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1'.

Warning

Errors or warnings encountered during VEX compile:

/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1).

Warning

Errors or warnings encountered during VEX compile:

/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1).

Warning

Vex error: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1)

Failed to resolve VEX code op:
/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1

Unable to load shader 'op:/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1'

 

Any ideas?

Thank you

Marta

Link to comment
Share on other sites

  • 1 year later...

This was frustrating but found the issue. Posting it here since it looks like the vex compiler bug hasnt been fixed:

looks like a vex compiler bug

traced it down to you have to make your custom structs be defined before the first call to len() although it probably holds for any array functions

so ended up having to move all base custom structs into a base header file with no references to any array functions

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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...