Thanks all
This problem has been settled.
There seems that the difference order of include head files will make difference.
There is the code
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <string>
#include <iostream>
#include "opencv2\highgui\highgui.hpp"
#include "opencv2\imgproc\imgproc.hpp"
#include "core\libeblearn\include\ebl_states.h"
#include "tools\libeblearntools\include\opencv.h"
//#include "core\libeblearn\include\ebl_states.h"
#pragma comment(lib,"comctl32.lib");
#ifdef _DEBUG
#pragma comment(lib,"D:\\work\\EBLearn\\eblearn-1.1\\bin\\debug\\eblearntools.lib");
#pragma comment(lib,"D:\\work\\EBLearn\\eblearn-1.1\\bin\\debug\\eblearn.lib");
#pragma comment(lib,"D:\\work\\EBLearn\\eblearn-1.1\\bin\\debug\\idx.lib");
#pragma comment(lib,"D:\\work\\EBLearn\\eblearn-1.1\\bin\\debug\\idxgui.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\3rdparty\\lib\\Debug\\libjasperd.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\3rdparty\\lib\\Debug\\libjpegd.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\3rdparty\\lib\\Debug\\libpngd.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\3rdparty\\lib\\Debug\\libtiffd.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\3rdparty\\lib\\Debug\\zlibd.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\lib\\Debug\\opencv_core242d.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\lib\\Debug\\opencv_imgproc242d.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\lib\\Debug\\opencv_highgui242d.lib");
#else
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\3rdparty\\lib\\Release\\zlib.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\lib\\Release\\opencv_core242.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\lib\\Release\\opencv_imgproc242.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\lib\\Release\\opencv_highgui242.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\lib\\Release\\opencv_features2d242.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\lib\\Release\\opencv_ml242.lib")
#endif
int _tmain(int argc, _TCHAR* argv[])
{
std::string file = "3_1185.png";
cv::Mat img = cv::imread(file);
if(!img.data) {
std::cout<<"can't read image\n";
exit(-1);
}
if(1 != img.channels()) cv::cvtColor(img, img, CV_BGR2GRAY);
IplImage IplImg = img;
ebl::idx<int> idxImg(img.rows, img.cols);
ebl::ipl_to_idx(&IplImg, idxImg);
ebl::parameter<double> W;
return 0;
}
Here are the outputs of compiling
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1>Build started 13/10/2012 09:26:54.
1>InitializeBuildStatus:
1> Touching "Debug\test.unsuccessfulbuild".
1>ClCompile:
1> test.cpp
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\stl.h(309): warning C4275: non dll-interface struct 'std::_Container_base12' used as base for dll-interface class 'std::_String_val<_Elem,_Alloc>'
1> with
1> [
1> _Elem=char,
1> _Alloc=std::allocator<char>
1> ]
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(73) : see declaration of 'std::_Container_base12'
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(717): error C2628: 'ebl::idx<T>' followed by 'char' is illegal (did you forget a ';'?)
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(720): error C2628: 'ebl::idx<T>' followed by 'char' is illegal (did you forget a ';'?)
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.hpp(1486): error C2628: 'ebl::idx<T>' followed by 'char' is illegal (did you forget a ';'?)
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.hpp(1497): error C2628: 'ebl::idx<T>' followed by 'char' is illegal (did you forget a ';'?)
1>test.cpp(15): warning C4081: expected 'newline'; found ';'
1>test.cpp(18): warning C4081: expected 'newline'; found ';'
1>test.cpp(19): warning C4081: expected 'newline'; found ';'
1>test.cpp(20): warning C4081: expected 'newline'; found ';'
1>test.cpp(21): warning C4081: expected 'newline'; found ';'
1>test.cpp(23): warning C4081: expected 'newline'; found ';'
1>test.cpp(24): warning C4081: expected 'newline'; found ';'
1>test.cpp(25): warning C4081: expected 'newline'; found ';'
1>test.cpp(26): warning C4081: expected 'newline'; found ';'
1>test.cpp(27): warning C4081: expected 'newline'; found ';'
1>test.cpp(29): warning C4081: expected 'newline'; found ';'
1>test.cpp(30): warning C4081: expected 'newline'; found ';'
1>test.cpp(31): warning C4081: expected 'newline'; found ';'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.05
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
If I change the order of the included files
Like this
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <string>
#include <iostream>
#include "opencv2\highgui\highgui.hpp"
#include "opencv2\imgproc\imgproc.hpp"
//#include "core\libeblearn\include\ebl_states.h"
#include "tools\libeblearntools\include\opencv.h"
#include "core\libeblearn\include\ebl_states.h"
#pragma comment(lib,"comctl32.lib");
#ifdef _DEBUG
#pragma comment(lib,"D:\\work\\EBLearn\\eblearn-1.1\\bin\\debug\\eblearntools.lib");
#pragma comment(lib,"D:\\work\\EBLearn\\eblearn-1.1\\bin\\debug\\eblearn.lib");
#pragma comment(lib,"D:\\work\\EBLearn\\eblearn-1.1\\bin\\debug\\idx.lib");
#pragma comment(lib,"D:\\work\\EBLearn\\eblearn-1.1\\bin\\debug\\idxgui.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\3rdparty\\lib\\Debug\\libjasperd.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\3rdparty\\lib\\Debug\\libjpegd.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\3rdparty\\lib\\Debug\\libpngd.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\3rdparty\\lib\\Debug\\libtiffd.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\3rdparty\\lib\\Debug\\zlibd.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\lib\\Debug\\opencv_core242d.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\lib\\Debug\\opencv_imgproc242d.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242StaticVC2010\\lib\\Debug\\opencv_highgui242d.lib");
#else
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\3rdparty\\lib\\Release\\zlib.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\lib\\Release\\opencv_core242.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\lib\\Release\\opencv_imgproc242.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\lib\\Release\\opencv_highgui242.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\lib\\Release\\opencv_features2d242.lib");
#pragma comment(lib,"..\\..\\..\\opencv\\OpenCV242Static\\lib\\Release\\opencv_ml242.lib")
#endif
int _tmain(int argc, _TCHAR* argv[])
{
std::string file = "D:\\work\\CANPRIC_V2\\data\\videalert\\mnistDB\\rawImg\\3_1185.png";
cv::Mat img = cv::imread(file);
if(!img.data) {
std::cout<<"can't read image\n";
exit(-1);
}
if(1 != img.channels()) cv::cvtColor(img, img, CV_BGR2GRAY);
IplImage IplImg = img;
ebl::idx<int> idxImg(img.rows, img.cols);
ebl::ipl_to_idx(&IplImg, idxImg);
ebl::parameter<double> W;
return 0;
}
The compiling will be fine!
Best
Sunny