Jump to content
demian

VEX array of structs

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×