Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Redeclaration issue

I'm trying to build OpenCV project (cpp) with following inclusions:

include "opencv2/imgcodecs.hpp"

include "opencv2/highgui/highgui.hpp"

and getting an error during the make "redeclaration issues.

It happens because of imgcodecs.hpp contains declaration:

enum {
   IMREAD_UNCHANGED  = -1, // 8bit, color or not
   IMREAD_GRAYSCALE  = 0,  // 8bit, gray
   IMREAD_COLOR      = 1,  // ?, color
   IMREAD_ANYDEPTH   = 2,  // any depth, ?
   IMREAD_ANYCOLOR   = 4,  // ?, any color
   IMREAD_LOAD_GDAL  = 8   // Use gdal driver
   };

And highgui.hpp contains basically the same:

enum {
// 8bit, color or not
IMREAD_UNCHANGED  =-1,
// 8bit, gray
IMREAD_GRAYSCALE  =0,
// ?, color
IMREAD_COLOR      =1,
// any depth, ?
IMREAD_ANYDEPTH   =2,
// ?, any color
IMREAD_ANYCOLOR   =4
};

Is any way to fix it without changing hpp files of OpenCV?

I'm really newbie at c++ thus my question could be dummy (sorry for that)

click to hide/show revision 2
No.2 Revision

updated 2015-01-09 15:13:23 -0500

berak gravatar image

Redeclaration issue

I'm trying to build OpenCV project (cpp) with following inclusions:

include "opencv2/imgcodecs.hpp"

include "opencv2/highgui/highgui.hpp"

#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"

and getting an error during the make "redeclaration issues.

It happens because of imgcodecs.hpp contains declaration:

 enum {
   IMREAD_UNCHANGED  = -1, // 8bit, color or not
   IMREAD_GRAYSCALE  = 0,  // 8bit, gray
   IMREAD_COLOR      = 1,  // ?, color
   IMREAD_ANYDEPTH   = 2,  // any depth, ?
   IMREAD_ANYCOLOR   = 4,  // ?, any color
   IMREAD_LOAD_GDAL  = 8   // Use gdal driver
   };

And highgui.hpp contains basically the same:

 enum {
// 8bit, color or not
IMREAD_UNCHANGED  =-1,
// 8bit, gray
IMREAD_GRAYSCALE  =0,
// ?, color
IMREAD_COLOR      =1,
// any depth, ?
IMREAD_ANYDEPTH   =2,
// ?, any color
IMREAD_ANYCOLOR   =4
};

Is any way to fix it without changing hpp files of OpenCV?

I'm really newbie at c++ thus my question could be dummy (sorry for that)

click to hide/show revision 3
retagged

updated 2015-01-09 15:15:24 -0500

berak gravatar image

Redeclaration issue

I'm trying to build OpenCV project (cpp) with following inclusions:

#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"

and getting an error during the make "redeclaration issues.

It happens because of imgcodecs.hpp contains declaration:

 enum {
   IMREAD_UNCHANGED  = -1, // 8bit, color or not
   IMREAD_GRAYSCALE  = 0,  // 8bit, gray
   IMREAD_COLOR      = 1,  // ?, color
   IMREAD_ANYDEPTH   = 2,  // any depth, ?
   IMREAD_ANYCOLOR   = 4,  // ?, any color
   IMREAD_LOAD_GDAL  = 8   // Use gdal driver
   };

And highgui.hpp contains basically the same:

 enum {
// 8bit, color or not
IMREAD_UNCHANGED  =-1,
// 8bit, gray
IMREAD_GRAYSCALE  =0,
// ?, color
IMREAD_COLOR      =1,
// any depth, ?
IMREAD_ANYDEPTH   =2,
// ?, any color
IMREAD_ANYCOLOR   =4
};

Is any way to fix it without changing hpp files of OpenCV?

I'm really newbie at c++ thus my question could be dummy (sorry for that)