SuperElastix / SimpleElastix

Multi-lingual medical image registration library
http://simpleelastix.github.io
Apache License 2.0
507 stars 149 forks source link

Undefined reference to itk::simple::ImageRegistrationMethod::~ImageRegistrationMethod() #464

Open laithanh77 opened 2 years ago

laithanh77 commented 2 years ago

Hi,

I compiled SimpleElastix for Ubuntu in accordance to the guidelines and I get an error when using the package in C++

Sample code:

#include <iostream>
#include <SimpleITK.h>
#include <sitkImageOperators.h>
#include <iostream>
#include <stdlib.h>
#include <iomanip>

namespace sitk = itk::simple;

int main()
{
    std::cout << "Hello World!" << std::endl;
    sitk::ImageRegistrationMethod R;
}

The compilation syntax:

g++ -I../../builds/SimpleElastix/include/SimpleITK-2.0/ -L../../builds/SimpleElastix/lib/ --std=c++11 -o test_code test_code.cpp

The error:

/usr/bin/ld: /tmp/ccfUDeKj.o: in function `main':
test_code.cpp:(.text+0x51): undefined reference to `itk::simple::ImageRegistrationMethod::ImageRegistrationMethod()'
/usr/bin/ld: test_code.cpp:(.text+0x60): undefined reference to `itk::simple::ImageRegistrationMethod::~ImageRegistrationMethod()'
collect2: error: ld returned 1 exit status

I get a similar undefined reference error when instantiating an Image object too.

My g++ version:

g++ (Ubuntu 10.3.0-1ubuntu1) 10.3.0

Thank you

Kunyadav commented 1 year ago

hi i dont have answer for your question rather i have a question, i am trying to build/compile simpleElastic for my C++ project but i am not able to succeed, can you tell me how did you get or create simpleITK C++ library? Regards Kunal