[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Linking in libpgm
From: |
Paul Pluzhnikov |
Subject: |
Re: Linking in libpgm |
Date: |
23 Sep 2004 07:35:10 -0700 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
"Dave Rudolf" <nuclearwhippingboy@hotmail.com> writes:
> I am trying to use libpgm and libpbm into a C++ program, but I get the
> following at link time:
>
> : undefined reference to `pm_freearray(char**, int)'
The C++ name mangling has got you.
The prototypes for the pm_openr() etc. are missing the 'extern "C"' prefix.
> So is there some reason why the linker gets confused on these libs?
The linker is not confused. It is simply looking for
"pm_freearray__FPPci" or "_Z12pm_freearrayPPci" instead of
"pm_freearray" that it should be looking for (use "nm" to verify
that).
The problem is in your source (or in libpbm header file).
> I should be able to use raw C libraries in my C++ code, should I not?
Yes, that works just fine.
> If so, then can anyone tell me what is going on here?
Since /usr/include/pbm.h (on my system, and probably on yours)
doesn't have 'extern "C"' guards, you must include it like this:
extern "C" {
#include <pbm.h>
}
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.