English 中文(简体)
设法在 n子和地板上工作
原标题:Trying to get fastcgi to work in nginx and c++

下面是我的C++代码和我的组合文件。

when I run spawn-fcgi -a120.0.0.1 -p9000 -n ./rtb.o

我发现这一错误。

spawn-fcgi: exec failed: Exec format error

Here is my c++ code that I complied as rtb.o

#include "fcgi_stdio.h"
#include <stdlib.h>
using namespace std;
int main()
  {
      int count = 1;
      while(FCGI_Accept() >= 0)
          printf("Content-type: text/html
"
                 "
"
                 "<title>FastCGI Hello!</title>"
                 "<h1>FastCGI Hello!</h1>"
                 "Request number %d running on host 
",
                  ++count);
      return 0;
  }

因此,我做了什么错误?

最佳回答

You re attempting to run a program called rtb.o? Is this an object file or an executable? You might want to show us how you compile your program. If you re doing something like

g++ -c rtb.cpp

然后,你将获得一份标书,并且需要将其链接起来,以获得一项工作方案。 采用<代码>/rtb.o从您的终端运行。 如果它照搬同一信息,那么你就会发现一个物体档案,需要尝试这样的东西:

g++ -o rtb rtb.cpp

Remember to add a reference to the FCGI library when you link (use the -l option).

问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签