The mex command generated inside test_HIL.m errors when running on gcc due to the inclusion of C++ style comments in the FPGAclientMATLAB source code file. To fix this, the command must tell the compiler to use C99. The modified command is: mex CFLAGS="$CFLAGS -std=c99" FPGAclientMATLAB.c