I'm using Microsoft visual studios and cmake wrapper to write a script with the insight toolkit package... just beginning and having some I/O errors. I'm very new to using object oriented programming, so don't feel you'll insult me if you answer as you would to a 2 year old.
// sjk 130524 this source file should contain all of the input/output operations on this data
#include <iostream>
#include <string>
#include "itkImageFileReader.h"
#include "IO.h"
void Read_Raw_Data(ReaderType::Pointer reader, char *filename) { //input raw data
typedef itk::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
} //Read_Raw_Data
2>Reg_script.obj : error LNK2019: unresolved external symbol "void __cdecl Read_Raw_Data(class itk::SmartPointer<class itk::ImageFileReader<class itk::Image<double,2>,class itk::DefaultConvertPixelTraits<double>
> >,char *)" (?Read_Raw_Data@@YAXV?$SmartPointer@V?$ImageFileReader@V?$Image@N$01@itk@@V?$DefaultConvertPixelTraits@N@2@@itk@@@itk@@PAD@Z) referenced in function _main
2>C:\ITK\scripts\registration\build\Debug\Reg_script.exe : fatal error LNK1120: 1 unresolved externals
I've been searching for a solution, generally this error occurs when a called function has no body, but mine does have a body. I suspect it's a cmake issue, somehow my cmakelists.txt file isn't providing for Reg_script.cxx to talk with IO.h that's my guess anyways. Can anybody help?
generally this error occurs when a called function has no body, but mine does have a body.
Generally this error occurs when the definition of the function is not supplied to the linker. How does Cmakelists.txt account for the compilation of IO.cpp and linking against the corresponding object code?
Strange, I think I tried that already as the obvious fix and cmake failed to configure. Let me try again on Monday and see what happens. Maybe there's another error coming across after that is fixed...
Thanks for the link. I must need to work on my googling skills because I searched for some time....