making a .cgi in c++ work?

Jun 20, 2012 at 7:53am
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 Jun 20, 2012 at 1:50pm
Jun 20, 2012 at 8:07am
Last edited on Jun 20, 2012 at 8:10am
Jun 20, 2012 at 1:49pm
sorry, this does not address my problem
Jun 20, 2012 at 2:29pm
Compile first the program (preferably directly on the server), give it chmod 755 and it should work.
Topic archived. No new replies allowed.