<div>I have a problem with building/linking to an external library I&#39;ve called libfio. The library builds, and I can link programs against it from the command line. However my final plugin always comes up with a &quot;ld: symbol(s) not found&quot;. I have several other libraries which are linked against just fine in my plugin, it is only this one which creates a problem.</div>
<div><br></div><meta charset="utf-8"><meta charset="utf-8"><div>I&#39;m on OS X 10.6, using gcc version 4.2.1 (Apple Inc. build 5664). I have tried building it both as a shared and static library, from both CMake and externally (then linking from within CMake). I have several other libraries I rely on which function perfectly well under any of the previous setups: {shared,static} x {built within plugin cmake, built externally} x {c,cxx}.  However with this set of .c files I always get a linking error, and it&#39;s the same for any of the previous permutations. Under any configuration I&#39;m able to link against it from the command line. That is to say for the example for a shared library built within the PV plugin CMake: libfio.dylib is created within my build directory ParaViz_build, and doing e.g.  gcc grafic2csv.c -lfio -L/Users/corbett/Documents/Projects/pvaddons/ParaViz/ParaViz_build/  -o grafic2csv has no linking errors, where grafic2csv contains the identical code which later offends the linker within my plugin (see below for sample).</div>
<meta charset="utf-8"><div><br></div><div>Example make output for a shared library built within the PV Plugin CMake:</div><div>...</div><div>[ 11%] Built target TipsyHelpers</div><div>[ 13%] Building C object CMakeFiles/fio.dir/fio/fio.c.o</div>
<div>[ 14%] Building C object CMakeFiles/fio.dir/fio/romberg.c.o</div><div>Linking C shared library libfio.dylib</div><div>[ 14%] Built target fio</div><div>[ 16%] Building C object CMakeFiles/SQLitelib.dir/sqlitelib/sqlite3.c.o</div>
<div>Linking C static library libSQLitelib.a</div><div>[ 16%] Built target SQLitelib</div><div>..</div><div>[ 98%] Building CXX object CMakeFiles/AstroVizPlugin.dir/AstroVizPlugin_Plugin.cxx.o</div><div>[100%] Building CXX object CMakeFiles/AstroVizPlugin.dir/moc_AstroVizPlugin_Plugin.cxx.o</div>
<div>Linking CXX shared library libAstroVizPlugin.dylib</div><div>Undefined symbols:</div><div>  &quot;fioOpen(char const*, double, double)&quot;, referenced from:</div><div>      vtkGraficReader::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*)in vtkGraficReader.cxx.o</div>
<div>ld: symbol(s) not found</div><div>collect2: ld returned 1 exit status</div><div>make[2]: *** [libAstroVizPlugin.dylib] Error 1</div><div>make[1]: *** [CMakeFiles/AstroVizPlugin.dir/all] Error 2</div><div>make: *** [all] Error 2</div>
<div><br></div><div><br></div><div><br></div><div>Example CMake for building a static library with the PV Plugin CMake:</div><div><div><br></div><div>ADD_LIBRARY(</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>fio</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>STATIC</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>fio/fio.c</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>fio/romberg.c</div>
<div>)</div><div>SET_TARGET_PROPERTIES(fio PROPERTIES LINKER_LANGUAGE C)</div><div>SET_TARGET_PROPERTIES(fio PROPERTIES COMPILE_FLAGS &quot;-fPIC&quot;)</div><div><br></div><div>TARGET_LINK_LIBRARIES(</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>AstroVizPlugin</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>fio</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>TipsyHelpers</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>SQLitelib</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>)</div></div><div><br></div>