1

この HelloWorld CGI C++ プログラムで誰かが私を助けてくれることを願っています。localhost で Xamp サーバーを実行しており、このコードを /xamp 内の cgi-bin フォルダーにコンパイルしました。ファイル名は_1.exeです

#include <iostream>

using namespace std;

int main(int argc, char** argv) {
    cout <<"Content-Type: text/html\n\n";                                       

    cout << "<?xml version = \"1.0\" encoding=\"ISO-8859-1\"?>" <<endl;          
    cout <<"<!DOCTYPE html Public \"-//W3C//DTD XHTML 1.1//EN\" "<<endl;
    cout << " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"<<endl;

    cout <<"<html xmlns = \"http://www.w3.org.1999/xhtml\lang=\"en\" xml:lang=\"en\"\">"<<endl;
    cout <<"<head><title>Helloworld</title></head>"<<endl;                          

    cout <<"<body><h1>Hello world!!</h1></body></html>";
    return 0;
}

実行可能ファイルは Windows から実行されますが、サーバーから呼び出すと、次のようになります。

Error message:
Premature end of script headers: _1.exe 

Netbeans と cygwin ツールでコンパイルしています。

ファイルの名前も_1.cgiに変更しようとしました

4

1 に答える 1

1

とった。_1.exe にアクセス許可の問題がありました。

于 2012-06-23T20:41:12.570 に答える