jstippey
17th March 2011, 14:35
Currently, I am trying to learn how to write more robust code that is more easily extendable. For this, I am trying to create a class that opens up TIFF images and performs some basic Image processing process ( find Max pixel etc...). I am using QT 3.1 (I know later versions support TIFF, but I am trying to learn here). I am using a open source library called libtiff. My basic layout is set up like this
TIFFImage.h
#ifndef TIFFIMAGE_H
#define TIFFIMAGE_H
#include<stdio.h>
#include<tiffio.h>
#include<tiff.h>
#include<tiffvers.h>
class QVariant;
class QString;
class TIFFImage
{
public:
TIFFImage();
~TIFFImage(); {}
private:
bool loadTIFF ( const QString fileNameTIFF, const char readWriteOption);
}
endif
TIFFImage.cpp
#include "tiffimage.h"
#include<stdio.h>
#include<tiffio.h>
#include<tiff.h>
#include<tiffvers.h>
TIFFImage::TIFFImage()
bool TIFFImage::loadTIFF(const QString fileNameTIFF, const char readWriteOption)
{
TIFF * tif = TIFFOpen(fileNameTIFF, readWriteOption);
if (tif==Null)
{
return false;
}
return true;
}
}
I then have a form I created with QT Designer that I want to call this class from. However when I try to compile I get a error in tiffimage.cpp
"error expected initializer before bool" from the line that loadTIFF function is implemented. I am sure I am making some simple mistake, but I haven't been able to figure it out. Any help would be appreciated.
TIFFImage.h
#ifndef TIFFIMAGE_H
#define TIFFIMAGE_H
#include<stdio.h>
#include<tiffio.h>
#include<tiff.h>
#include<tiffvers.h>
class QVariant;
class QString;
class TIFFImage
{
public:
TIFFImage();
~TIFFImage(); {}
private:
bool loadTIFF ( const QString fileNameTIFF, const char readWriteOption);
}
endif
TIFFImage.cpp
#include "tiffimage.h"
#include<stdio.h>
#include<tiffio.h>
#include<tiff.h>
#include<tiffvers.h>
TIFFImage::TIFFImage()
bool TIFFImage::loadTIFF(const QString fileNameTIFF, const char readWriteOption)
{
TIFF * tif = TIFFOpen(fileNameTIFF, readWriteOption);
if (tif==Null)
{
return false;
}
return true;
}
}
I then have a form I created with QT Designer that I want to call this class from. However when I try to compile I get a error in tiffimage.cpp
"error expected initializer before bool" from the line that loadTIFF function is implemented. I am sure I am making some simple mistake, but I haven't been able to figure it out. Any help would be appreciated.