[Insight-developers] linker won't build new library

M Stauffer (V) mstauff at verizon.net
Tue May 31 11:22:10 EDT 2011


Hi Luis,

0) The source file actually has the itkArray1DToDataTest(int, char* [])
signature. Seems the linker just reports it as "char **".

1) I'm not building with shared libs. That is, cmake option
BUILD_SHARED_LIBS is off. But the class is declared with ITK_EXPORT
anyway.

The repo is available here: git at github.com:picslITK/ITK4_topics.git
The branch is RegRefactoringStaufferWorking
The files are:
Modules/Registration/Refactoring/src/itkArray1DToData.cxx
Modules/Registration/Refactoring/include/itkArray1DToData.h

Thanks for taking a look. I can't see what I'm missing in terms of cmake
config. I've also tried a clean build, but that's not helping.

Cheers,
Michael

>-----Original Message-----
>From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
>Sent: Sunday, May 29, 2011 8:54 AM
>To: M Stauffer (V)
>Cc: ITK-dev-list-mstauff at ver
>Subject: Re: [Insight-developers] linker won't build new library
>
>Hi Michael,
>
>0) You are using the test signature:
>
>          itkArray1DToDataTest(int, char**)
>
>     while, it should be:
>
>          itkArray1DToDataTest(int, char* [])
>
>     as in
>
>   itkArray1DToDataTest(int argc, char * argv [] )
>
>
>1) Are you building Shared Libraries ?
>
>If so,
>
>
>2) Did you put the EXPORT symbol in the
>    declaration of the Array1DToData class ?
>
>
>3) Is your code in a place where we could take a look ?
>
>
>
>   Thanks
>
>
>          Luis
>
>
>-------------------------------------------------------------
>On Fri, May 27, 2011 at 8:19 PM, M Stauffer (V) 
><mstauff at verizon.net> wrote:
>> Hi,
>>
>> I'm having trouble building a test. I'm working in a new experimental
>> module:
>> Modules/Registration/Refactoring. So far we've only had 
>templated code
>> and
>> it's been working fine. I added a non-templated class today, so added
>> src/.
>> I can't get it to build now. It seems the library is not 
>being built (I
>> don't
>> see it in MyBuildDir/lib/, which is where it seems it should be?).I'm
>> getting
>> this linker error:
>>
>> Undefined symbols:
>>  "typeinfo for itk::Array1DToData", referenced from:
>>      itkArray1DToDataTest(int, char**)in itkArray1DToDataTest.cxx.o
>>  "itk::Array1DToData::Array1DToData()", referenced from:
>>      itkArray1DToDataTest(int, char**)in itkArray1DToDataTest.cxx.o
>>
>> The ctor and some other methods are defined in the cxx file.
>>
>> Cmake has been setup to build all modules.
>>
>> Any suggestions? I'm sure I'm missing something simple. Thanks.
>>
>> Here are some relevant file contents:
>>
>> Modules/Registration/Refactoring/CMakeLists.txt  looks like:
>> --------------
>> project(ITK-RegistrationRefactoring)
>> set(ITK-RegistrationRefactoring_LIBRARIES 
>ITK-RegistrationRefactoring)
>> itk_module_impl()
>> --------------
>>
>> Modules/Registration/Refactoring/src/CMakeLists.txt looks like:
>> (I'm not sure about all the target_link_libraries includes)
>> -------------
>> set(ITK-RegistrationRefactoring_SRC
>> itkArray1DToData.cxx
>> )
>>
>> add_library(ITK-RegistrationRefactoring
>> ${ITK-RegistrationRefactoring_SRC})
>> target_link_libraries(ITK-RegistrationRefactoring
>> ${ITK-Registration_LIBRARIES} ${ITK-Optimizers_LIBRARIES}
>> ${ITK-ImageIntensity_LIBRARIES} ${ITK-ImageFunction_LIBRARIES}
>> ${ITK-ImageGrid_LIBRARIES} ${ITK-SpatialObjects_LIBRARIES}
>> ${ITK-Smoothing_LIBRARIES} ${ITK-ImageGradient_LIBRARIES}
>> ${ITK-ImageFeature_LIBRARIES} ${ITK-FiniteDifference_LIBRARIES})
>> itk_module_target(ITK-RegistrationRefactoring)
>> --------------
>>
>> If I change the name of itkArray1DToData.cxx above, cmake 
>complains, so
>> it's
>> at least parsing this file.
>>
>> Modules/Registration/Refactoring/test/CMakeLists.txt looks like:
>> ---------------
>> itk_module_test()
>> set(ITK-RegistrationRefactoringTests
>>  itkDeformationFieldTransformRegistrationTest.cxx
>>  itkTransformParametersTest.cxx
>>  itkImageVectorTransformParametersHelperTest.cxx
>>  itkArray1DToDataTest.cxx
>> )
>>
>> CreateTestDriver(ITK-RegistrationRefactoring
>> "${ITK-RegistrationRefactoring-Test_LIBRARIES}"
>> "${ITK-RegistrationRefactoringTests}")
>>
>> <snip other "add_tests">
>>
>> add_test(NAME itkArray1DToDataTest
>>         COMMAND ITK-RegistrationRefactoringTestDriver
>> itkArray1DToDataTest)
>> --------------
>>
>>
>> Modules/Registration/Refactoring/itk-module.cmake looks like:
>> ----------------
>> itk_module(ITK-RegistrationRefactoring DEPENDS ITK-RegistrationCommon
>> ITK-Optimizers ITK-ImageIntensity ITK-ImageFunction ITK-ImageGrid
>> ITK-SpatialObjects ITK-Smoothing ITK-ImageGradient ITK-ImageFeature
>> ITK-FiniteDifference TEST_DEPENDS ITK-TestKernel ITK-Review)
>> ----------------
>>
>> Thanks,
>> Michael
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>



More information about the Insight-developers mailing list