C++ fcgio.cpp:50: 错误: 'EOF' 未在此范围内声明
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4577453/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
fcgio.cpp:50: error: 'EOF' was not declared in this scope
提问by skyeagle
I am attempting to build fastcgi on a Linux Ubuntu 10.x machine.
我正在尝试在 Linux Ubuntu 10.x 机器上构建 fastcgi。
I run the following commands:
我运行以下命令:
./configure make
./配置制作
and I get the following error:
我收到以下错误:
fcgio.cpp: In destructor 'virtual fcgi_streambuf::~fcgi_streambuf()':
fcgio.cpp:50: error: 'EOF' was not declared in this scope
fcgio.cpp: In member function 'virtual int fcgi_streambuf::overflow(int)':
fcgio.cpp:70: error: 'EOF' was not declared in this scope
fcgio.cpp:75: error: 'EOF' was not declared in this scope
fcgio.cpp: In member function 'virtual int fcgi_streambuf::sync()':
fcgio.cpp:86: error: 'EOF' was not declared in this scope
fcgio.cpp:87: error: 'EOF' was not declared in this scope
fcgio.cpp: In member function 'virtual int fcgi_streambuf::underflow()':
fcgio.cpp:107: error: 'EOF' was not declared in this scope
make[2]: *** [fcgio.lo] Error 1
make[2]: Leaving directory `/somepath/fcgi-2.4.0/libfcgi'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/somepath/fcgi-2.4.0'
make: *** [all] Error 2
I notice that others have had the same problem and have asked this question in various fora etc - however, I have not as yet, seen an answer to this question/problem.
我注意到其他人也有同样的问题,并在各种论坛等中问过这个问题 - 但是,我还没有看到这个问题/问题的答案。
Has anyone ever managed to build fastcgi on Linux? How do I fix this problem?
有没有人设法在 Linux 上构建 fastcgi?我该如何解决这个问题?
回答by ?? Tiib
EOF is a C macro and seems that you do not have it defined in fcgio.cpp or that something has undefined it. I would first try to add #include <stdio.h>
to start of fcgio.cpp.
EOF 是一个 C 宏,似乎您没有在 fcgio.cpp 中定义它或者某些东西未定义它。我会首先尝试添加#include <stdio.h>
到 fcgio.cpp 的开头。
回答by Homme Zwaagstra
I had the same problem on Ubuntu 11.10 Linux 64bit. Following most of @paercebal's advice I created the following patch which resolved the problem:
我在 Ubuntu 11.10 Linux 64bit 上遇到了同样的问题。按照@paercebal 的大部分建议,我创建了以下解决问题的补丁:
--- include/fcgio.h 2012-01-23 15:23:51.136063795 +0000
+++ include/fcgio.h 2012-01-23 15:22:19.057221383 +0000
@@ -31,6 +31,7 @@
#define FCGIO_H
#include <iostream>
+#include <stdio.h>
#include "fcgiapp.h"
回答by Shadi Namrouti
Use -1
instead
使用-1
替代
EOF is defined in <stdio.h>
as follows:
EOF 定义<stdio.h>
如下:
#define EOF (-1)
or (more professionally), you may put the following code above your main() or inside your header file:
或者(更专业),您可以将以下代码放在 main() 上方或头文件中:
#ifndef EOF
#define EOF (-1)
#endif