[Insight-users] Help with Writing Own GPU enabled filter/ Linker Error

Joachim Weber joachim.weber at stud.hs-regensburg.de
Sun Jan 6 13:26:09 EST 2013


Hi,
maybe someone can help me. I am writing my own GPU enabled filter, but i always get a linker error.

error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall itk::TestFilter<class itk::GPUImage<float,3>,class itk::GPUImage<float,3> >::TestFilter<class itk::GPUImage<float,3>,class itk::GPUImage<float,3> >(void)" (??0?$TestFilter at V?$GPUImage at M$02 at itk@@V12@@itk@@QAE at XZ)" in Funktion ""public: static class itk::SmartPointer<class itk::GPUImageToImageFilter<class itk::GPUImage<float,3>,class itk::GPUImage<float,3>,class itk::ImageToImageFilter<class itk::GPUImage<float,3>,class itk::GPUImage<float,3> > > > __cdecl itk::TestFilter<class itk::GPUImage<float,3>,class itk::GPUImage<float,3> >::New(void)" (?New@?$TestFilter at V?$GPUImage at M$02 at itk@@V12@@itk@@SA?AV?$SmartPointer at V?$GPUImageToImageFilter at V?$GPUImage at M$02 at itk@@V12 at V?$ImageToImageFilter at V?$GPUImage at M$02 at itk@@V12@@2@@itk@@@2 at XZ)"

I am using VS2010. 

Heres the Code
kmean.h:
#define _FILTER_H

#include "itkOpenCLUtil.h"
#include "itkGPUKernelManager.h"
#include <iostream>
#include "itkGPUImage.h"
#include "itkGPUImageToImageFilter.h"

namespace itk
{

itkGPUKernelClassMacro(TestFilterKernel);

template< class TInputImage, class TOutputImage >
class TestFilter:
	public GPUImageToImageFilter< TInputImage, TOutputImage >
{
public:
	itkNewMacro(TestFilter);
	itkTypeMacro(TestFilter, GPUImageToImageFilter);
	TestFilter();
	~TestFilter();
	void GPUGenerateData();
};
}
#endif

kmean.cpp
#include "kmean.h"
namespace itk
{

template< class TInputImage, class TOutputImage >
TestFilter<TInputImage, TOutputImage>::TestFilter()
{
}

template< class TInputImage, class TOutputImage >
void TestFilter< TInputImage, TOutputImage >::GPUGenerateData()
{
}

template< class TInputImage, class TOutputImage >
TestFilter<TInputImage, TOutputImage>::~TestFilter()
{
}

}


ITK was compiled with static linking(MT instead of MD; Shared_Libs unchecked) and with ITK_GPU enabled.


Here is my CMakeFile:
cmake_minimum_required(VERSION 2.6)

project( MAIN )

find_package ( OpenCL)

FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})
 
include_directories( ${kmean_cl_SOURCE_DIR})

include_directories(${OPENCL_INCLUDE_DIRS})

message("include directories: \n")
get_directory_property(includes INCLUDE_DIRECTORIES)
message("${includes}\n")

set(SOURCE
   ${SOURCE}
   ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/gpu_handler.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/kmean.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/kmean.cxx
)

set(HEADERS
   ${HEADERS}
   ${CMAKE_CURRENT_SOURCE_DIR}/gpu_handler.h
   ${CMAKE_CURRENT_SOURCE_DIR}/kmean.h
)

message("${HEADERS}\n")
message("${SOURCE}\n")

add_executable( MAIN ${SOURCE} ${HEADERS})

target_link_libraries( MAIN ${ITK_LIBRARIES} )
target_link_libraries( MAIN ${OpenCl_LIBRARIES} )


I hope this is the right to ask for help. I hope it is not an error based on my CMake(or the options MT).
I am pretty new to ITK.

Thank you very much in advance.





More information about the Insight-users mailing list