[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[help-cgicc] Compiling fcgi-test.cpp
From: |
nblew |
Subject: |
[help-cgicc] Compiling fcgi-test.cpp |
Date: |
Fri, 30 Mar 2007 05:55:06 -0700 (PDT) |
I’ll be the first to confess that I don’t know what I’m doing. It’s been
awhile since I’ve worked in C++ and I’m trying to get fcgi-test.cpp to
build.
My environment:
Windows XP
Apache 2.x
VC6
I had FastCGI running on Apache and wanted to get it working with cgicc, so
I attempted to build cgicc. I immediately got a host of “error C2039:
‘isspace’ is not an element of ‘std’” – type errors, so I stripped out any
“std::” prefix that the compiler complained about (probably a bad move).
Cgicc then compiled and I put cgicc.lib and cgicc.dll in places where my
fcgi-test project could get to them (cgicc.lib in /visual studio/vc98/libs/
until I figured out a better place for it and cgicc.dll in
/windows/system32).
Then I attempted to compile fcgi-test.cpp:
#include <exception>
#include <iostream>
#include "cgicc/Cgicc.h"
#include "cgicc/HTTPHTMLHeader.h"
#include "cgicc/HTMLClasses.h"
#include "FCgiIO.h"
// To use the debug logging feature, the variable gLogFile MUST be
// defined, and it _must_ be an ofstream
#if DEBUG
std::ofstream gLogFile( "/Debug/cgicc.log", std::ios::app );
#endif
using namespace std;
using namespace cgicc;
int
main(int /*argc*/,
const char **/*argv*/,
char **/*envp*/)
{
unsigned count = 0;
FCGX_Request request;
FCGX_Init();
FCGX_InitRequest(&request, 0, 0);
while(FCGX_Accept_r(&request) == 0) {
try {
FCgiIO IO(request);
Cgicc CGI(&IO);
// Output the HTTP headers for an HTML document, and the HTML 4.0 DTD
info
IO << HTTPHTMLHeader() << HTMLDoctype( HTMLDoctype::eStrict ) << endl
<< html().set( "lang", "en" ).set( "dir", "ltr" ) << endl;
// Set up the page's header and title.
IO << head() << endl
<< title() << "GNU cgicc v" << CGI.getVersion() << title() << endl
<< head() << endl;
// Start the HTML body
IO << body() << endl;
// Print out a message
IO << h1("Cgicc/FastCGI Test") << endl
<< "count: " << count++ << br() << endl;
IO << "Form Elements:" << br() << endl;
for(const_form_iterator i = CGI.getElements().begin();
i != CGI.getElements().end(); ++i )
IO << i->getName() << " = " << i->getValue() << br() << endl;
// Close the document
IO << body() << html();
}
catch(const exception&) {
// handle error condition
}
FCGX_Finish_r(&request);
}
return 0;
}
It failed with a boatload of warnings (ugh) and 2 errors:
Linking...
fcgi-test.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) public: void __thiscall cgicc::FCgiIO::`vbase
destructor'(void)" (address@hidden@@QAEXXZ)
fcgi-test.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) public: __thiscall cgicc::FCgiIO::FCgiIO(struct
FCGX_Request &)" (address@hidden@@address@hidden@@@Z)
c:\development\httpd\fcgi-bin\test.fcgi : fatal error LNK1120: 2 unresolved
externals
…
The compiler apparently is having a problem with the line FCgiIO
IO(request);
Happily hacking away, I added # define CGICC_EXPORTS 1 in cgidefs.h, which
eliminated the first link error. My changes to cgidefs.h are excerpted
here:
…
// Win32-specific setup
#ifdef WIN32
// HACK ALERT: forcing dllexport
# define CGICC_EXPORTS 1
// export library symbols
# ifdef CGICC_EXPORTS
# define CGICC_API __declspec(dllexport)
# else
# define CGICC_API __declspec(dllimport)
# endif
# define HOST "Win32"
# define VERSION "3.2.3"
#else
# define CGICC_API
#endif /* WIN32 */
#endif /* ! _CGIDEFS_H_ */
…
I’m stuck on the second link error. Of course, even if I somehow managed to
hack the second link error away I’ll certainly still have problems. So
hopefully an expert out there can show me how to build cgicc and
fcgi-test.cpp the right way and get this up and running
Much thanks for accommodating my complete lack-of-clues…
--
View this message in context:
http://www.nabble.com/Compiling-fcgi-test.cpp-tf3492021.html#a9752568
Sent from the cgicc - General mailing list archive at Nabble.com.
- [help-cgicc] Compiling fcgi-test.cpp,
nblew <=