[Insight-users] Problems reading an image

Bill Lorensen bill.lorensen at gmail.com
Wed Nov 12 11:57:54 EST 2008


Remove:
const int "football.jpg" = argv[1];

It is not a valid C++ statement.


On Wed, Nov 12, 2008 at 10:12 AM, Leidy Paola Dorado Muñoz
<doradoleidypao at gmail.com> wrote:
> Hello  all,
>
> I'm starting to work with ITK and I'm trying to read an image (*.jpg)  but
> some errors occur when I build all project.
> These are the errors:
>
> 1>..\..\src\readImage\readImage.cxx(17) : error C2598: linkage specification
> must be at global scope
> 1>..\..\src\readImage\readImage.cxx(17) : warning C4518: 'const int ' :
> storage-class or type specifier(s) unexpected here; ignored
> 1>..\..\src\readImage\readImage.cxx(17) : warning C4502: 'linkage
> specification' requires use of keyword 'extern' and must precede all other
> specifiers
> 1>..\..\src\readImage\readImage.cxx(17) : error C2537: 'football.jpg' :
> illegal linkage specification
> 1>..\..\src\readImage\readImage.cxx(17) : error C2513: 'int' : no variable
> declared before '='
> 1>Build log was saved at
> "file://w:\Registration_Review\bin\readImage\readImage.dir\Debug\BuildLog.htm"
> 1>readImage - 3 error(s), 2 warning(s)
> 2>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------
> 2>"Build all projects"
> 2>Build log was saved at
> "file://w:\Registration_Review\bin\readImage\ALL_BUILD.dir\Debug\BuildLog.htm"
> 2>ALL_BUILD - 0 error(s), 0 warning(s)
> ========== Build: 1 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
>
> CMake Lists.txt that I use is:
>
> # This project is designed to be built outside the Insight source tree.
>
> PROJECT(readImage)
>
> # Find ITK
>
> INCLUDE_REGULAR_EXPRESSION("^.*$")
>
> FIND_PACKAGE(ITK REQUIRED)
>
> IF(ITK_FOUND)
>   INCLUDE(${ITK_USE_FILE})
> ENDIF(ITK_FOUND)
>
> ADD_EXECUTABLE(readImage readImage.cxx )
>
> TARGET_LINK_LIBRARIES(readImage ITKIO)
>
>
> And file *.cxx is:
>
>
> #if defined(_MSC_VER)
> #pragma warning ( disable : 4786 )
> #endif
>
> #include "itkImage.h"
> #include "itkImageFileReader.h"
>
> int main( int , int argv[1])
> {
>   typedef unsigned int          PixelType;
>   const unsigned int            Dimension = 3;
>
>   typedef itk::Image< PixelType, Dimension > ImageType;
>   typedef itk::ImageFileReader< ImageType >  ReaderType;
>
>   ReaderType::Pointer reader = ReaderType::New();
>   const int "football.jpg" = argv[1];
>   reader->SetFileName("football.jpg");
>   reader->Update();
>   ImageType::Pointer image = reader->GetOutput();
>
>   return 0;
> }
>
> thanks in advance to all those who can help me with this problem because I
> am just a novice in this language programming
> --
>
> Leidy Paola Dorado-Muñoz
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list