下面是我的c++代码和配置文件。
当我运行spawn-fcgi -a120.0.0.1 -p9000 -n ./rtb.o时
我得到了这个错误
spawn-fcgi: exec failed: Exec format error下面是我编译为rtb.o的c++代码
#include "fcgi_stdio.h"
#include <stdlib.h>
using namespace std;
int main()
{
int count = 1;
while(FCGI_Accept() >= 0)
printf("Content-type: text/html\r\n"
"\r\n"
"<title>FastCGI Hello!</title>"
"<h1>FastCGI Hello!</h1>"
"Request number %d running on host \n",
++count);
return 0;
}那么,我做错了什么?
发布于 2012-01-14 23:35:59
你在尝试运行一个叫rtb.o的程序?这是目标文件还是可执行文件?你可能想告诉我们你是如何编译你的程序的。如果你正在做像这样的事情
g++ -c rtb.cpp然后,您将获得一个对象文件,您需要将其链接以获得一个工作程序。尝试使用./rtb.o从您的终端运行它。如果它打印相同的消息,那么您已经有了一个对象文件,并且需要尝试如下所示:
g++ -o rtb rtb.cpp记得在链接时添加对FCGI库的引用(使用-l选项)。
https://stackoverflow.com/questions/8862869
复制相似问题