3 AnswersNew Answer
Madubuike David, you seem to misundersrand cgi programming. The script or executable program you wish to execute on the server does not require a .cgi extension. I suggest that you read https://www.oreilly.com/openbook/cgi/ for more information about cgi programming. Note that while cgi programming is simple to use on low bandwidth sites it is generally considered to be an outdated technology.
Just compile your C++ program for your target environment, place it in your cgi-bin folder, and it should work. You don’t really need extensions in a Linux server, but you could rename your app to whatever. More important is that your program knows how to input/output correctly and that your hosting machine allows cgi. Many don’t.
That's cross domain exploitation, so you'll have to work with that with current stuff or set up something. Have you considered compiling to wasm?