[Insight-users] Linking external libraries?
Harri Tapio Jaalinoja
harri.jaalinoja@helsinki.fi
Tue, 5 Nov 2002 17:39:55 +0200 (EET)
Hi Luis,
thanks again for your help! read_img was indeed in libbsoft:
[hajaalin@gene hajaalin]$ cd /usr/local/bsoft/lib
[hajaalin@gene lib]$ ls
libbsoft.a libbsoft.so* libfftw.a libtiff.a
[hajaalin@gene lib]$ grep read_img *
Binary file libbsoft.a matches
Binary file libbsoft.so matches
[hajaalin@gene lib]$
But the solution lay in moving the #include <rwMRC.h> away from the
extern block. The reason I put it there was a newbie guess, the code is in
C as opposed to C++. Why string.h and stdio.h were there I don't know,
I copied it from the WatershedExample.
Cheers,
Harri
On Tue, 5 Nov 2002, Luis Ibanez wrote:
>
> Hi Harri,
>
> The LINK_LIBRARIES command in you CMakeLists.txt
> file looks fine. Still the linker seems to be
> unhappy with the "read_img" symbol.
>
> Does the "read_img" function belong to your
> libbsoft.so library ?
>
> Is it defined somewhere else ?
>
> ---
>
> Also, you don't need to set the headers
> string.h and stdio.h inside the extern "C"
> block.
>
> Is there any reason for placing your header
> "rwMRC.h" in the extern "C" block ?
>
>
>
> Luis
>
>
> ===============================================
> Harri Tapio Jaalinoja wrote:
> > Hi all!
> >
> > I am trying to bring new libraries to my code (based on an ITK example):
> >
> > extern "C" {
> > #include <rwMRC.h>
> > #include <string.h>
> > #include <stdio.h>
> > }
> >
> > Including rwMRC.h is ok, it seems that I was able to include the headers
> > correctly. However, I have so far not managed to import also the
> > corresponding libraries. This is my current attempt (in CMakeLists.txt):
> >
> > LINK_LIBRARIES (
> > ITKAlgorithms
> > VXLNumerics
> > ITKBasicFilters
> > ITKCommon
> > ITKIO
> > /usr/local/bsoft/lib/libbsoft.so
> > )
> >
> > The last item is the library that is still missing:
> >
> > bWatershed.o: In function `main':
> > bWatershed.o(.text+0x2b5): undefined reference to `read_img'
> >
> > I hope you see what I'm aiming at and can point out the correct way to do
> > it :)
> >
> > Attached are the complete output from make and my CMakeList.txt and
> > CMakeCache.txt
> > files.
> >
> > Thanks!
> >
> > Harri
> >
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>