[ITK-users] Linker error when using Loop subdivision on Mac

DVigneault davis.vigneault at gmail.com
Thu Mar 17 18:42:08 EDT 2016


All--

I'm getting a linker error (undefined symbols for
itk::NumericTraits<float>::Zero) when compiling a simple program against the
development branch of ITK on OS X 10.10.5 (Yosemite) with
Module_SubdivisionQuadEdgeMesh ON.  (I'm using the XCode toolchain compiler
with c++11.)  I only get this error on Mac--the same program compiles
without a problem on Ubuntu 14.04.  I tried a clean build of ITK but without
luck.  I went poking around itkNumericTraits.h, and the template
specialization (including ::Zero) is defined right in the header, which is
confusing.  Any ideas what I might have done wrong?

Best,

--Davis

#########
## Source ##
#########

#include <itkQuadEdgeMesh.h>
#include <itkLoopTriangleCellSubdivisionQuadEdgeMeshFilter.h>

typedef itk::QuadEdgeMesh< float, 3 > TMesh;
typedef itk::LoopTriangleCellSubdivisionQuadEdgeMeshFilter< TMesh, TMesh >
TLoop;

int main()
{
  TLoop::Pointer loop = TLoop::New();
  return EXIT_SUCCESS;
}

##############
## CMakeLists.txt ##
##############

cmake_minimum_required(VERSION 2.8.12)
 
project(dv-linker)

set(ITK_DIR "~/Developer/ITK/bin")
set(CMAKE_CXX_FLAGS "-std=c++11" CACHE STRING "cxx compiler flags" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra" CACHE STRING "cxx debug
compiler flags" FORCE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "build type" FORCE)

find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

add_executable(dv-linker dv-linker.cxx)
target_link_libraries(dv-linker ${ITK_LIBRARIES})

#############
## Linker Error  ##
#############

$ make
-- Configuring done
-- Generating done
-- Build files have been written to:
/Users/Davis/Developer/BitBucket/oxford/examples/ITK/dv-linker/bin
[ 50%] Linking CXX executable dv-linker
Undefined symbols for architecture x86_64:
  "itk::NumericTraits<float>::Zero", referenced from:
     
itk::LoopTriangleCellSubdivisionQuadEdgeMeshFilter<itk::QuadEdgeMesh<float,
3u, itk::QuadEdgeMeshTraits<float, 3u, bool, bool, float, float> >,
itk::QuadEdgeMesh<float, 3u, itk::QuadEdgeMeshTraits<float, 3u, bool,
bool, float, float> > >::AddNewCellPoints(itk::CellInterface<float,
itk::QuadEdgeMeshCellTraitsInfo<3, float, float, unsigned long, unsigned
long, unsigned char, itk::QuadEdgeMeshPoint<float, 3u,
itk::GeometricalQuadEdge<unsigned long, unsigned long, bool, bool, true>
>, itk::MapContainer<unsigned long, itk::QuadEdgeMeshPoint<float, 3u,
itk::GeometricalQuadEdge<unsigned long, unsigned long, bool, bool, true>
> >, std::__1::set<unsigned long, std::__1::less<unsigned long>,
std::__1::allocator<unsigned long> >, itk::GeometricalQuadEdge<unsigned
long, unsigned long, bool, bool, true> > >*) in dv-linker.cxx.o
     
itk::LoopTriangleCellSubdivisionQuadEdgeMeshFilter<itk::QuadEdgeMesh<float,
3u, itk::QuadEdgeMeshTraits<float, 3u, bool, bool, float, float> >,
itk::QuadEdgeMesh<float, 3u, itk::QuadEdgeMeshTraits<float, 3u, bool,
bool, float, float> > >::SmoothingPoint(itk::QuadEdgeMeshPoint<float, 3u,
itk::GeometricalQuadEdge<unsigned long, unsigned long, bool, bool, true>
> const&, itk::MapContainer<unsigned long, itk::QuadEdgeMeshPoint<float,
3u, itk::GeometricalQuadEdge<unsigned long, unsigned long, bool, bool,
true> > > const*) in dv-linker.cxx.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make[2]: *** [dv-linker] Error 1
make[1]: *** [CMakeFiles/dv-linker.dir/all] Error 2
make: *** [all] Error 2





--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Linker-error-when-using-Loop-subdivision-on-Mac-tp7588625.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list