Hi,<div><br></div><div>Thanks! Yes that fixed things. I was using another straight C library that worked just fine so didn't realize this could be required.</div><div><br>Christine<br><br><div class="gmail_quote">On Fri, Mar 4, 2011 at 1:15 AM, Takuya OSHIMA <span dir="ltr"><<a href="mailto:oshima@eng.niigata-u.ac.jp">oshima@eng.niigata-u.ac.jp</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I guess 'extern "C"' is missing in the declaration of fioOpen?<br>
<br>
Takuya<br>
<br>
Takuya OSHIMA, Ph.D.<br>
Faculty of Engineering, Niigata University<br>
8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN<br>
<br>
From: Christine Corbett Moran <<a href="mailto:corbett@physik.uzh.ch">corbett@physik.uzh.ch</a>><br>
Subject: [Paraview] mysterious linker error for custom library in custom PV Plugin<br>
Date: Thu, 3 Mar 2011 16:57:48 +0100<br>
<div><div></div><div class="h5"><br>
> I have a problem with building/linking to an external library I've called<br>
> libfio. The library builds, and I can link programs against it from the<br>
> command line. However my final plugin always comes up with a "ld: symbol(s)<br>
> not found". I have several other libraries which are linked against just<br>
> fine in my plugin, it is only this one which creates a problem.<br>
><br>
> I'm on OS X 10.6, using gcc version 4.2.1 (Apple Inc. build 5664). I have<br>
> tried building it both as a shared and static library, from both CMake and<br>
> externally (then linking from within CMake). I have several other libraries<br>
> I rely on which function perfectly well under any of the previous setups:<br>
> {shared,static} x {built within plugin cmake, built externally} x {c,cxx}.<br>
> However with this set of .c files I always get a linking error, and it's<br>
> the same for any of the previous permutations. Under any configuration I'm<br>
> able to link against it from the command line. That is to say for the<br>
> example for a shared library built within the PV plugin CMake: libfio.dylib<br>
> is created within my build directory ParaViz_build, and doing e.g. gcc<br>
> grafic2csv.c -lfio<br>
> -L/Users/corbett/Documents/Projects/pvaddons/ParaViz/ParaViz_build/ -o<br>
> grafic2csv has no linking errors, where grafic2csv contains the identical<br>
> code which later offends the linker within my plugin (see below for sample).<br>
><br>
> Example make output for a shared library built within the PV Plugin CMake:<br>
> ...<br>
> [ 11%] Built target TipsyHelpers<br>
> [ 13%] Building C object CMakeFiles/fio.dir/fio/fio.c.o<br>
> [ 14%] Building C object CMakeFiles/fio.dir/fio/romberg.c.o<br>
> Linking C shared library libfio.dylib<br>
> [ 14%] Built target fio<br>
> [ 16%] Building C object CMakeFiles/SQLitelib.dir/sqlitelib/sqlite3.c.o<br>
> Linking C static library libSQLitelib.a<br>
> [ 16%] Built target SQLitelib<br>
> ..<br>
> [ 98%] Building CXX object<br>
> CMakeFiles/AstroVizPlugin.dir/AstroVizPlugin_Plugin.cxx.o<br>
> [100%] Building CXX object<br>
> CMakeFiles/AstroVizPlugin.dir/moc_AstroVizPlugin_Plugin.cxx.o<br>
> Linking CXX shared library libAstroVizPlugin.dylib<br>
> Undefined symbols:<br>
> "fioOpen(char const*, double, double)", referenced from:<br>
> vtkGraficReader::RequestData(vtkInformation*, vtkInformationVector**,<br>
> vtkInformationVector*)in vtkGraficReader.cxx.o<br>
> ld: symbol(s) not found<br>
> collect2: ld returned 1 exit status<br>
> make[2]: *** [libAstroVizPlugin.dylib] Error 1<br>
> make[1]: *** [CMakeFiles/AstroVizPlugin.dir/all] Error 2<br>
> make: *** [all] Error 2<br>
><br>
><br>
><br>
> Example CMake for building a static library with the PV Plugin CMake:<br>
><br>
> ADD_LIBRARY(<br>
> fio<br>
> STATIC<br>
> fio/fio.c<br>
> fio/romberg.c<br>
> )<br>
> SET_TARGET_PROPERTIES(fio PROPERTIES LINKER_LANGUAGE C)<br>
> SET_TARGET_PROPERTIES(fio PROPERTIES COMPILE_FLAGS "-fPIC")<br>
><br>
> TARGET_LINK_LIBRARIES(<br>
> AstroVizPlugin<br>
> fio<br>
> TipsyHelpers<br>
> SQLitelib<br>
> )<br>
</div></div></blockquote></div><br></div>