The error is not fully shown. Please provide full error. Also, there are chances that it can be due to some linking problem of NVIDIA build tools to the path in which MATLAB is executing codegen. You can try using the following command for setting the path of NVIDIA’s build-in tools:
After running the command try performing codegen operation again.
Hope this helps!