incompatible types in assignment of 'int*' to 'int [0]'
The issue is with flexible array int _teamIRCodes[]; This is an old technique which I don't recommend. But if you want to use it, you need you use malloc to create a class object, adding on enough space for the array:

// Allocate space for the class AND the array
Gun *gun = (Gun *)malloc(sizeof(Gun) + sizeof(teamIRCodes));


However, this does not call the ctor, and you still have to manually copy the data:

for(int i = 0; i &lt; (sizeof(teamIRCodes) / sizeof(teamIRCodes[0])); i++) {
    gun-&gt;_teamIRCodes[i] = teamIRCodes[i];
}


I think it's much simpler to use a pointer:

int* _teamIRCodes;


Then you can make your ctor:

Gun(String identifier, String name, int teamIRCodes[], int numberOfCodes) {
    _teamIRCodes = new int[numberOfCodes];
    // memcpy does the same thing as the for loop - copies the array
    memcpy(_teamIRCodes, teamIRCodes, sizeof(teamIRCodes[0]) * numberOfCodes);
}


And don' forget to add a dtor:

~Gun() {
    delete [] _teamIRCodes;
}


Or, if teamIRCodes is persistent throughout the lifetime of the object, you can just use a pointer to it:

 class Gun {
     public:
     int *_teamIRCodes;
     int _numberOfCodes;
     Gun(String identifier, String name, int teamIRCodes[], int numberOfCodes) {
         _teamIRCodes = teamIRCodes;
         _numberOfCodes = numberOfCodes;
   };


(Maybe this is an Arduino thing as this is the 2nd flexible array question I've seen today).