Can't compile demo program...

JR Newsletters <[email protected]> Tue, 30 Sep 2003 14:40:43 -0500
Newsgroups gmane.comp.gcc.cgicc.general
Message-ID <[email protected]>
Hello,

I have compiled and installed cgicc-3.2.2 on my Gentoo Linux system, and 
I'm trying to compile the demo program for a test cgi script.  I am 
using gcc-3.3 for my compiler.  I have set up a very primitive 
Makefile.  When I try to build the demo program, I keep getting a bunch 
of error messages that are claiming I don't have any of the references 
for cgi even though it is not complaining about not being able to find 
the include files.  I have the cgicc include files under 
/usr/include/cgicc and the cgicc libraries are under /usr/lib.  I have 
put the error dump when I build, my Makefile, and the Demo Program I'm 
trying to use.  Can anybody give me a clue why this demo program is not 
building?  I'm sure it is something obvious I'm not seeing.

Thanks in advance.

-------------

The Error Messages:

g++ -I /usr/include -I /usr/local/include -I /usr/include/cgicc -I 
/usr/include -I /usr/local/include -I /usr/include/cgicc main.cc
/tmp/ccEo5zeE.o(.text+0x27): In function `main':
: undefined reference to `cgicc::Cgicc::Cgicc[in-charge](cgicc::CgiInput*)'
/tmp/ccEo5zeE.o(.text+0x35): In function `main':
: undefined reference to 
`cgicc::HTTPHTMLHeader::HTTPHTMLHeader[in-charge]()'
/tmp/ccEo5zeE.o(.text+0x4b): In function `main':
: undefined reference to `cgicc::operator<<(std::basic_ostream<char, 
std::char_traits<char> >&, cgicc::MStreamable const&)'
/tmp/ccEo5zeE.o(.text+0x83): In function `main':
: undefined reference to `cgicc::HTTPHTMLHeader::~HTTPHTMLHeader 
[in-charge]()'
/tmp/ccEo5zeE.o(.text+0xa2): In function `main':
: undefined reference to `cgicc::HTTPHTMLHeader::~HTTPHTMLHeader 
[in-charge]()'
/tmp/ccEo5zeE.o(.text+0x130): In function `main':
: undefined reference to `cgicc::operator<<(std::basic_ostream<char, 
std::char_traits<char> >&, cgicc::MStreamable const&)'
/tmp/ccEo5zeE.o(.text+0x142): In function `main':
: undefined reference to `cgicc::operator<<(std::basic_ostream<char, 
std::char_traits<char> >&, cgicc::MStreamable const&)'
/tmp/ccEo5zeE.o(.text+0x2cd): In function `main':
: undefined reference to `cgicc::operator<<(std::basic_ostream<char, 
std::char_traits<char> >&, cgicc::MStreamable const&)'
/tmp/ccEo5zeE.o(.text+0x380): In function `main':
: undefined reference to 
`cgicc::Cgicc::getElement(std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccEo5zeE.o(.text+0x422): In function `main':
: undefined reference to `cgicc::Cgicc::getElements() const'
/tmp/ccEo5zeE.o(.text+0x47d): In function `main':
: undefined reference to `cgicc::FormEntry::operator*() const'
/tmp/ccEo5zeE.o(.text+0x547): In function `main':
: undefined reference to `cgicc::operator<<(std::basic_ostream<char, 
std::char_traits<char> >&, cgicc::MStreamable const&)'
/tmp/ccEo5zeE.o(.text+0x559): In function `main':
: undefined reference to `cgicc::operator<<(std::basic_ostream<char, 
std::char_traits<char> >&, cgicc::MStreamable const&)'
/tmp/ccEo5zeE.o(.text+0x609): In function `main':
: undefined reference to `cgicc::Cgicc::~Cgicc [in-charge]()'
/tmp/ccEo5zeE.o(.text+0x625): In function `main':
: undefined reference to `cgicc::Cgicc::~Cgicc [in-charge]()'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7htmlTagEEC1Ev+0x2d): 
In function 
`cgicc::HTMLBooleanElement<cgicc::htmlTag>::HTMLBooleanElement[in-charge]()':
: undefined reference to 
`cgicc::HTMLElement::HTMLElement[not-in-charge](cgicc::HTMLAttributeList 
const*, cgicc::HTMLElement const*, std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const*, 
cgicc::HTMLElement::EElementType)'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7htmlTagEED1Ev+0x16): 
In function 
`cgicc::HTMLBooleanElement<cgicc::htmlTag>::~HTMLBooleanElement 
[in-charge]()':
: undefined reference to `cgicc::HTMLElement::~HTMLElement 
[not-in-charge]()'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_8titleTagEEC1ERKSs+0x2c): 
In function 
`cgicc::HTMLBooleanElement<cgicc::titleTag>::HTMLBooleanElement[in-charge](std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to 
`cgicc::HTMLElement::HTMLElement[not-in-charge](cgicc::HTMLAttributeList 
const*, cgicc::HTMLElement const*, std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const*, 
cgicc::HTMLElement::EElementType)'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_8titleTagEED1Ev+0x16): 
In function 
`cgicc::HTMLBooleanElement<cgicc::titleTag>::~HTMLBooleanElement 
[in-charge]()':
: undefined reference to `cgicc::HTMLElement::~HTMLElement 
[not-in-charge]()'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7headTagEEC1ERKNS_11HTMLElementE+0x2c): 
In function 
`cgicc::HTMLBooleanElement<cgicc::headTag>::HTMLBooleanElement[in-charge](cgicc::HTMLElement 
const&)':
: undefined reference to 
`cgicc::HTMLElement::HTMLElement[not-in-charge](cgicc::HTMLAttributeList 
const*, cgicc::HTMLElement const*, std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const*, 
cgicc::HTMLElement::EElementType)'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7headTagEED1Ev+0x16): 
In function 
`cgicc::HTMLBooleanElement<cgicc::headTag>::~HTMLBooleanElement 
[in-charge]()':
: undefined reference to `cgicc::HTMLElement::~HTMLElement 
[not-in-charge]()'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7bodyTagEEC1Ev+0x2d): 
In function 
`cgicc::HTMLBooleanElement<cgicc::bodyTag>::HTMLBooleanElement[in-charge]()':
: undefined reference to 
`cgicc::HTMLElement::HTMLElement[not-in-charge](cgicc::HTMLAttributeList 
const*, cgicc::HTMLElement const*, std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const*, 
cgicc::HTMLElement::EElementType)'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7bodyTagEED1Ev+0x16): 
In function 
`cgicc::HTMLBooleanElement<cgicc::bodyTag>::~HTMLBooleanElement 
[in-charge]()':
: undefined reference to `cgicc::HTMLElement::~HTMLElement 
[not-in-charge]()'
/tmp/ccEo5zeE.o(.gnu.linkonce.r._ZTVN5cgicc18HTMLBooleanElementINS_7bodyTagEEE+0x10): 
undefined reference to 
`cgicc::HTMLElement::render(std::basic_ostream<char, 
std::char_traits<char> >&) const'
/tmp/ccEo5zeE.o(.gnu.linkonce.r._ZTVN5cgicc18HTMLBooleanElementINS_7headTagEEE+0x10): 
undefined reference to 
`cgicc::HTMLElement::render(std::basic_ostream<char, 
std::char_traits<char> >&) const'
/tmp/ccEo5zeE.o(.gnu.linkonce.r._ZTVN5cgicc18HTMLBooleanElementINS_8titleTagEEE+0x10): 
undefined reference to 
`cgicc::HTMLElement::render(std::basic_ostream<char, 
std::char_traits<char> >&) const'
/tmp/ccEo5zeE.o(.gnu.linkonce.r._ZTVN5cgicc18HTMLBooleanElementINS_7htmlTagEEE+0x10): 
undefined reference to 
`cgicc::HTMLElement::render(std::basic_ostream<char, 
std::char_traits<char> >&) const'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7htmlTagEED0Ev+0x16): 
In function 
`cgicc::HTMLBooleanElement<cgicc::htmlTag>::~HTMLBooleanElement 
[in-charge deleting]()':
: undefined reference to `cgicc::HTMLElement::~HTMLElement 
[not-in-charge]()'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_8titleTagEED0Ev+0x16): 
In function 
`cgicc::HTMLBooleanElement<cgicc::titleTag>::~HTMLBooleanElement 
[in-charge deleting]()':
: undefined reference to `cgicc::HTMLElement::~HTMLElement 
[not-in-charge]()'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7headTagEED0Ev+0x16): 
In function 
`cgicc::HTMLBooleanElement<cgicc::headTag>::~HTMLBooleanElement 
[in-charge deleting]()':
: undefined reference to `cgicc::HTMLElement::~HTMLElement 
[not-in-charge]()'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7bodyTagEED0Ev+0x16): 
In function 
`cgicc::HTMLBooleanElement<cgicc::bodyTag>::~HTMLBooleanElement 
[in-charge deleting]()':
: undefined reference to `cgicc::HTMLElement::~HTMLElement 
[not-in-charge]()'
/tmp/ccEo5zeE.o(.gnu.linkonce.r._ZTIN5cgicc18HTMLBooleanElementINS_7htmlTagEEE+0x8): 
undefined reference to `typeinfo for cgicc::HTMLElement'
/tmp/ccEo5zeE.o(.gnu.linkonce.r._ZTIN5cgicc18HTMLBooleanElementINS_8titleTagEEE+0x8): 
undefined reference to `typeinfo for cgicc::HTMLElement'
/tmp/ccEo5zeE.o(.gnu.linkonce.r._ZTIN5cgicc18HTMLBooleanElementINS_7headTagEEE+0x8): 
undefined reference to `typeinfo for cgicc::HTMLElement'
/tmp/ccEo5zeE.o(.gnu.linkonce.r._ZTIN5cgicc18HTMLBooleanElementINS_7bodyTagEEE+0x8): 
undefined reference to `typeinfo for cgicc::HTMLElement'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7htmlTagEEC1ERKS2_+0x14): 
In function 
`cgicc::HTMLBooleanElement<cgicc::htmlTag>::HTMLBooleanElement[in-charge](cgicc::HTMLBooleanElement<cgicc::htmlTag> 
const&)':
: undefined reference to 
`cgicc::HTMLElement::HTMLElement[not-in-charge](cgicc::HTMLElement const&)'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_8titleTagEEC1ERKS2_+0x14): 
In function 
`cgicc::HTMLBooleanElement<cgicc::titleTag>::HTMLBooleanElement[in-charge](cgicc::HTMLBooleanElement<cgicc::titleTag> 
const&)':
: undefined reference to 
`cgicc::HTMLElement::HTMLElement[not-in-charge](cgicc::HTMLElement const&)'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7headTagEEC1ERKS2_+0x14): 
In function 
`cgicc::HTMLBooleanElement<cgicc::headTag>::HTMLBooleanElement[in-charge](cgicc::HTMLBooleanElement<cgicc::headTag> 
const&)':
: undefined reference to 
`cgicc::HTMLElement::HTMLElement[not-in-charge](cgicc::HTMLElement const&)'
/tmp/ccEo5zeE.o(.gnu.linkonce.t._ZN5cgicc18HTMLBooleanElementINS_7bodyTagEEC1ERKS2_+0x14): 
In function 
`cgicc::HTMLBooleanElement<cgicc::bodyTag>::HTMLBooleanElement[in-charge](cgicc::HTMLBooleanElement<cgicc::bodyTag> 
const&)':
: undefined reference to 
`cgicc::HTMLElement::HTMLElement[not-in-charge](cgicc::HTMLElement const&)'
collect2: ld returned 1 exit status
make: *** [webfamdispl] Error 1

=========

The Makefile:

# Makefile for wxX  helloworld example program

CC = g++
AS = as
LD = ld

RM = rm

CFLAGS =

CFLAGS = -I /usr/include -I /usr/local/include -I /usr/include/cgicc
LDFLAGS = -L /usr/lib -L /usr/local/lib 
LIBS = -lcgicc

TARGET = webfamdispl

SOURCES = main.cc

OBJECTS = main.o

$(TARGET) : $(SOURCES)
    $(CC) $(CFLAGS) $(CFLAGS) $(SOURCES)
    $(LD) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $(TARGET)

clean:
    $(RM) $(TARGET)

================

The Demo Program Source:

/* Created by Anjuta version 1.1.97 */
/*    This file will not be overwritten */

#include <iostream>
#include <vector>
#include <string>

#include <cgicc/Cgicc.h>
#include <cgicc/HTTPHTMLHeader.h>
#include <cgicc/HTMLClasses.h>

using namespace std;
using namespace cgicc;

int main(int argc, char **argv)
{
    try {
        Cgicc cgi;
       
        // Send HTTP header
        cout << HTTPHTMLHeader() << endl;

        // Set up the HTML document
        cout << html() << head(title("Cgicc example")) << endl;
        cout << body() << endl;

        // Print out the submitted element
        form_iterator name = cgi.getElement("name");
        if (name != cgi.getElements().end()) {
            cout << "Your name: " << **name << endl;
        }

        // Close the HTML document
        cout << body() << html();
    }
    catch (exception& e) {
        // handle any errors - omitted for brevity
    }

}