Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/140.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 无法通过C++;CGI_C++_Apache_Cgi - Fatal编程技术网

C++ 无法通过C++;CGI

C++ 无法通过C++;CGI,c++,apache,cgi,C++,Apache,Cgi,我试图用这个简单的C++来显示浏览器的输出。在我提交表单后,它应该将我的cgi文件中的这个家伙称为.cgi文件 #include <iostream> using namespace std; int main () { cout << "Content-type:text/html\r\n\r\n"; cout << "<html>\n"; cout << "<head>\n"; cout <

我试图用这个简单的C++来显示浏览器的输出。在我提交表单后,它应该将我的cgi文件中的这个家伙称为.cgi文件

#include <iostream>
using namespace std;

int main ()
{
   cout << "Content-type:text/html\r\n\r\n";
   cout << "<html>\n";
   cout << "<head>\n";
   cout << "<title>Hello World - First CGI Program</title>\n";
   cout << "</head>\n";
   cout << "<body>\n";
   cout << "<h2>Hello World! This is my first CGI program</h2>\n";
   cout << "</body>\n";
   cout << "</html>\n";

   return 0;
}
#包括
使用名称空间std;
int main()
{

您是否编译了该文件并将其设置为您的.cgi?如果您试图只访问脚本而不首先编译,则可能会出现问题(如果您习惯于使用PHP/其他脚本语言,则很容易出错)

这与您的web服务器配置的关系比您编写的任何代码的关系都要大。请检查您的web服务器错误日志。如何访问服务器日志?这取决于您的web服务器的设置方式。如果您不知道,请询问设置web服务器的人员。好的。我会这样做。谢谢您的帮助。这实际上是一个评论,不是回答。再重复一点。我将此帖子标记为删除。