GNU CGI using C++
GNU CGI using C++
我正在用c++ (Windows)编写CGI程序。我试图使用cookie,但我得到编译时错误。我使用了来自http://www.gnu.org/software/cgicc/
的GNU库我提取zip文件,并将文件夹放在我的包括文件夹在Dev c++目录。我也可以使用Visual studio (Visual c++)。但我还是得到了同样的错误。cicc名称空间无法识别。请帮帮我。如果你知道其他软件,我将使用它。请告诉我,在哪里以及如何添加库。
错误包括:
"C:UsersUSIDesktopUntitled1.cpp" -o "C:UsersUSIDesktopUntitled1.exe" -I"C:Dev-Cpplibgccmingw323.4.2include" -I"C:Dev-Cppincludec++3.4.2backward" -I"C:Dev-Cppincludec++3.4.2mingw32" -I"C:Dev-Cppincludec++3.4.2" -I"C:Dev-Cppinclude" -L"C:Dev-Cpplib"
C:UsersUSIDesktopUntitled1.cpp:8:27: cgicc/CgiDefs.h: No such file or directory
C:UsersUSIDesktopUntitled1.cpp:9:26: cgicc/Cgicc.h: No such file or directory
C:UsersUSIDesktopUntitled1.cpp:10:41: cgicc-3.0.1/HTTPHTMLHeader.h: No such file or directory
C:UsersUSIDesktopUntitled1.cpp:11:37: cgicc-3.0.1/HTMLClasses.h: No such file or directory
C:UsersUSIDesktopUntitled1.cpp:14: error: expected namespace-name before ';' token
C:UsersUSIDesktopUntitled1.cpp:14: error: `<type error>' is not a namespace
C:UsersUSIDesktopUntitled1.cpp: In function `int main()':
C:UsersUSIDesktopUntitled1.cpp:21: error: `Cgicc' undeclared (first use this function)
C:UsersUSIDesktopUntitled1.cpp:21: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:UsersUSIDesktopUntitled1.cpp:21: error: expected `;' before "cgi"
C:UsersUSIDesktopUntitled1.cpp:22: error: `const_cookie_iterator' undeclared (first use this function)
C:UsersUSIDesktopUntitled1.cpp:22: error: expected `;' before "cci"
C:UsersUSIDesktopUntitled1.cpp:37: error: expected primary-expression before "const"
C:UsersUSIDesktopUntitled1.cpp:37: error: expected `;' before "const"
C:UsersUSIDesktopUntitled1.cpp:39: error: `cci' undeclared (first use this function)
C:UsersUSIDesktopUntitled1.cpp:39: error: `env' undeclared (first use this function)
Execution terminated
#include <iostream>
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <cgicc/CgiDefs.h>
#include <cgicc/Cgicc.h>
#include <cgicc/HTTPHTMLHeader.h>
#include <cgicc/HTMLClasses.h>
using namespace std;
using namespace cgicc;
int main ()
{
Cgicc cgi;
const_cookie_iterator cci;
cout << "Set-Cookie:guessNo=2;rn";
cout << "Content-type:text/htmlrnrn";
cout << "Content-type:text/htmlrnrn";
cout << "<html>n";
cout << "<head>n";
cout << "<title>Cookies in CGI</title>n";
cout << "</head>n";
cout << "<body>n";
cout << "<table border = "0" cellspacing = "2">";
// get environment variables
const CgiEnvironment& env = cgi.getEnvironment();
for( cci = env.getCookieList().begin();
cci != env.getCookieList().end();
++cci )
{
cout << "<tr><td>" << cci->getName() << "</td><td>";
cout << cci->getValue();
cout << "</td></tr>n";
}
cout << "</table><n";
cout << "<br/>n";
cout << "</body>n";
cout << "</html>n";
return 0;
}
确保1) cgidef .h cgic .h, HTTPHTMLHeader.h和HTMLClasses.h都在cgic目录下2)cgic目录本身在Visual Studio c++编译器设置中的"附加包含目录"中列出的目录中,或与之等价的devc++目录。
你的错误表明编译器根本没有找到那些。h文件。
您似乎没有配置cgic头文件的路径。确保目录cicc和cicc -3.0.1位于使用-I标志设置的目录之一。
相关文章:
- "using namespace std;"在C++的作用是什么?
- vector<vector<double>> to mxArray using memcpy
- Using C++ CryptAPI:CNG Create CSR
- STLPort using C++11
- 函数中的 c++ using 语句,后跟函数名称(对于 ADL?
- Using getchar_unlocked()
- 类作用域的类型别名"using":[何时]方法中的用法可以先于类型别名?
- 嵌套命名空间的"using"指令,但需要命名内部命名空间
- 为什么"using System;"不被视为不良做法?
- 为什么我需要做'using namespace std'而不是"使用 std::cout"?
- 'using namespace'实现细节的便捷方法(仅标头库)?
- C++中"typedef"、"using"、"namespace"和"using namespace"有什么区别?
- 在"template"和函数声明之间使用:template<typename trait> using tr = base_trait<trait> void fn(tr::t
- 如何区分C++中的"using declaration"和"using directive"?
- C++ "using tcp=x"到"namespace tcp=x"有什么区别
- 如何为流输出运算符提供重载<<模板'using'类型别名?
- Using PrimitiveBatch::DrawIndexed with ID3D11DeviceContext::
- 如何创建一个 while 循环,继续循环,直到在C++中输入'using streams'键?
- 是否可以使用 using 将基类中的公共成员重新声明为派生类中的私有成员?
- Qt3D: using Qt3DRender::QLayerFilter