[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: compiling help



On Fri, Aug 20, 1999 at 10:27:16PM -0500, Stephen Pitts wrote:

> > But the file does not use libcgic it uses libcgi (here is the file)
> > When I compile with the suggested: cc -o cgitest cgitest.c -lcgi
> > it works fine, but when I change the cc to g++ I get: 

> Ahhh..you could have mentioned that in the post! I assumed you were
> using the cgic stuff that you mentioned in the first post to your other
> message.

> Honestly, I have no idea what is wrong. Perhaps someone who is better
> familar with the guts of gcc can help you. It appears that if cgi.c is
> compiled by g++ and cgitest.c is compiled by g++, then they link. If
> they are both compiled by gcc, then they link. Otherwise, not a chance.

What happens if you try wrapping the #include <cgi.h> like so:

   extern "C" {
   #include <cgi.h>
   }

Most Unix C++ compilers encode type information about symbols into the
names of objects they link to in order to enforce type checking between
modules.  The extern "C" tells the compiler to use the normal naming
system (just the symbol name).

-- 
Mark Brown  mailto:broonie@tardis.ed.ac.uk   (Trying to avoid grumpiness)
            http://www.tardis.ed.ac.uk/~broonie/
EUFS        http://www.eusa.ed.ac.uk/societies/filmsoc/

Attachment: pgpPwZNKjicj1.pgp
Description: PGP signature


Reply to: