Discussion:
[ITK-users] undefined reference to `vnl_vector<T>::~vnl_vector()'
Sureerat Reaungamornrat
2017-10-13 07:19:23 UTC
Permalink
Dear All,

I have a problem compiling a simple read-image-file code below in Fedora,
after I build ITK 4.12.1 from source code downloaded from the ITK website.
I did not receive any error for compiling ITK. For compilation of ITK
4.12.1, I did not change the default CMake options of the ITK library, and
the CMake options for compilation were set as

CMAKE_CXX_COMPILER /usr/lib64/ccache/c++
CMAKE_CXX_FLAGS -std=c++11 -pthread
CMAKE_EXE_LINKER_FLAGS -pthread

The error, from compiling the read-image-file code below, was all
"undefined reference to 'vnl_vector<T>::~vnl_vector()'" with some data
types T including long long, short, unsigned char, etc. I attached the file
containing the error (std::cerr from 'make' command for single-thread
compilation) to this email.


// Code --------------------------------------------------
#include "itkImageFileReader.h"

int main()
{
typedef itk::Image<float, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ImageFileReaderType;
ImageFileReaderType::Pointer reader = ImageFileReaderType::New();
reader->SetFileName("some_image_filename");
reader->Update();

ImageType::Pointer image = reader->GetOutput();

return EXIT_SUCCESS;
}

Thank you very much for you time and help,

Best regards,

Ja
Dženan Zukić
2017-10-13 13:59:49 UTC
Permalink
Hi Ja,

which CMakeLists.txt did you use for this simple example? Did you configure
you simple example with CMake or did you just invoke compiler directly? If
directly invoking the compiler, you need to pass a long list of ITK
libraries which need to be linked.

An example CMakeLists file is attached.

We are trying to migrate to a discussion forum, discourse.itk.org Can you
post future questions there?

Regards,
DÅŸenan

On Fri, Oct 13, 2017 at 3:19 AM, Sureerat Reaungamornrat <
Post by Sureerat Reaungamornrat
Dear All,
I have a problem compiling a simple read-image-file code below in Fedora,
after I build ITK 4.12.1 from source code downloaded from the ITK website.
I did not receive any error for compiling ITK. For compilation of ITK
4.12.1, I did not change the default CMake options of the ITK library, and
the CMake options for compilation were set as
CMAKE_CXX_COMPILER /usr/lib64/ccache/c++
CMAKE_CXX_FLAGS -std=c++11 -pthread
CMAKE_EXE_LINKER_FLAGS -pthread
The error, from compiling the read-image-file code below, was all
"undefined reference to 'vnl_vector<T>::~vnl_vector()'" with some data
types T including long long, short, unsigned char, etc. I attached the file
containing the error (std::cerr from 'make' command for single-thread
compilation) to this email.
// Code --------------------------------------------------
#include "itkImageFileReader.h"
int main()
{
typedef itk::Image<float, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ImageFileReaderType;
ImageFileReaderType::Pointer reader = ImageFileReaderType::New();
reader->SetFileName("some_image_filename");
reader->Update();
ImageType::Pointer image = reader->GetOutput();
return EXIT_SUCCESS;
}
Thank you very much for you time and help,
Best regards,
Ja
The ITK community is transitioning from this mailing list to
discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Sureerat Reaungamornrat
2017-10-13 15:17:44 UTC
Permalink
Dear DÅŸenan,

Thank you very much for your response. I have moved this content to the
discussion forum (discourse.itk.org).

I also answered your question in the forum. I used the same CMake file as
you provided, except that in my CMake, I set the CMake version as

cmake_minimum_required(VERSION 2.8)

where yours is
cmake_minimum_required(VERSION 3.6)

Is it because of this setting that triggers error?

//-------------------CMake file

cmake_minimum_required(VERSION 2.8)

project(read_image)

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

add_executable(test_read_image test_read_image.cxx)
target_link_libraries(test_read_image ${ITK_LIBRARIES})


Thank you very much again for your time and help,

Best regards,

Ja
Post by Dženan Zukić
Hi Ja,
which CMakeLists.txt did you use for this simple example? Did you
configure you simple example with CMake or did you just invoke compiler
directly? If directly invoking the compiler, you need to pass a long list
of ITK libraries which need to be linked.
An example CMakeLists file is attached.
We are trying to migrate to a discussion forum, discourse.itk.org Can you
post future questions there?
Regards,
DÅŸenan
On Fri, Oct 13, 2017 at 3:19 AM, Sureerat Reaungamornrat <
Post by Sureerat Reaungamornrat
Dear All,
I have a problem compiling a simple read-image-file code below in Fedora,
after I build ITK 4.12.1 from source code downloaded from the ITK website.
I did not receive any error for compiling ITK. For compilation of ITK
4.12.1, I did not change the default CMake options of the ITK library, and
the CMake options for compilation were set as
CMAKE_CXX_COMPILER /usr/lib64/ccache/c++
CMAKE_CXX_FLAGS -std=c++11 -pthread
CMAKE_EXE_LINKER_FLAGS -pthread
The error, from compiling the read-image-file code below, was all
"undefined reference to 'vnl_vector<T>::~vnl_vector()'" with some data
types T including long long, short, unsigned char, etc. I attached the file
containing the error (std::cerr from 'make' command for single-thread
compilation) to this email.
// Code --------------------------------------------------
#include "itkImageFileReader.h"
int main()
{
typedef itk::Image<float, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ImageFileReaderType;
ImageFileReaderType::Pointer reader = ImageFileReaderType::New();
reader->SetFileName("some_image_filename");
reader->Update();
ImageType::Pointer image = reader->GetOutput();
return EXIT_SUCCESS;
}
Thank you very much for you time and help,
Best regards,
Ja
The ITK community is transitioning from this mailing list to
discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Loading...