making a .cgi in c++ work?

I recently came to know about cgi. So I made a simple program in c++.
1
2
3
4
5
6
7
8
9
#include <iostream>
using namespace std;
int main()
{
	cout<<"Content-type: text/plain"<<endl<<endl;
	cout<<"Hello World!"<<endl;

	return 0;
}


saved the text and saved the file as script.cpp.cgi
uploaded it into the cgi-bin directory of my website

but when I open the mywebsite.com/cgi-bin/script.cpp.cgi
it gives me an error: Exec format error
Last edited on
Last edited on
sorry, this does not address my problem
Compile first the program (preferably directly on the server), give it chmod 755 and it should work.
Topic archived. No new replies allowed.