I guess 'extern "C"' is missing in the declaration of fioOpen? Takuya
Takuya OSHIMA, Ph.D. Faculty of Engineering, Niigata University 8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN From: Christine Corbett Moran <[email protected]> Subject: [Paraview] mysterious linker error for custom library in custom PV Plugin Date: Thu, 3 Mar 2011 16:57:48 +0100 > I have a problem with building/linking to an external library I'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 "ld: symbol(s) > not found". I have several other libraries which are linked against just > fine in my plugin, it is only this one which creates a problem. > > I'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's > the same for any of the previous permutations. Under any configuration I'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). > > Example make output for a shared library built within the PV Plugin CMake: > ... > [ 11%] Built target TipsyHelpers > [ 13%] Building C object CMakeFiles/fio.dir/fio/fio.c.o > [ 14%] Building C object CMakeFiles/fio.dir/fio/romberg.c.o > Linking C shared library libfio.dylib > [ 14%] Built target fio > [ 16%] Building C object CMakeFiles/SQLitelib.dir/sqlitelib/sqlite3.c.o > Linking C static library libSQLitelib.a > [ 16%] Built target SQLitelib > .. > [ 98%] Building CXX object > CMakeFiles/AstroVizPlugin.dir/AstroVizPlugin_Plugin.cxx.o > [100%] Building CXX object > CMakeFiles/AstroVizPlugin.dir/moc_AstroVizPlugin_Plugin.cxx.o > Linking CXX shared library libAstroVizPlugin.dylib > Undefined symbols: > "fioOpen(char const*, double, double)", referenced from: > vtkGraficReader::RequestData(vtkInformation*, vtkInformationVector**, > vtkInformationVector*)in vtkGraficReader.cxx.o > ld: symbol(s) not found > collect2: ld returned 1 exit status > make[2]: *** [libAstroVizPlugin.dylib] Error 1 > make[1]: *** [CMakeFiles/AstroVizPlugin.dir/all] Error 2 > make: *** [all] Error 2 > > > > Example CMake for building a static library with the PV Plugin CMake: > > ADD_LIBRARY( > fio > STATIC > fio/fio.c > fio/romberg.c > ) > SET_TARGET_PROPERTIES(fio PROPERTIES LINKER_LANGUAGE C) > SET_TARGET_PROPERTIES(fio PROPERTIES COMPILE_FLAGS "-fPIC") > > TARGET_LINK_LIBRARIES( > AstroVizPlugin > fio > TipsyHelpers > SQLitelib > ) _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
