Error at compiling the function "idx_m2oversample" and "idx_m2oversampleacc"

180 views
Skip to first unread message

Tianxu Jia

unread,
Oct 12, 2012, 4:22:46 PM10/12/12
to ebl...@googlegroups.com
Dear All
I am using EBLearn 1.1 at the platform VC2010. I compiled the all EBLearn successfully. But at my own application code, I added the lines

#include "core\libeblearn\include\ebl_states.h"
#include "core\libidx\include\idx.h"

int main function
I added

ebl::parameter<double> W;

Then there are errors

1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(716): error C2144: syntax error : 'char' should be preceded by ')'
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(716): error C2144: syntax error : 'char' should be preceded by ';'
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(716): warning C4091: '' : ignored on left of 'char' when no variable is declared
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(716): error C2143: syntax error : missing ';' before ','
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(716): error C2988: unrecognizable template declaration/definition
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(716): error C2059: syntax error : ','
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(716): error C2065: 'T' : undeclared identifier
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(716): error C2059: syntax error : ')'
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(719): error C2065: 'T' : undeclared identifier
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.h(719): error C2065: 'T' : undeclared identifier
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.hpp(1464): error C2144: syntax error : 'char' should be preceded by ')'
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.hpp(1464): error C2144: syntax error : 'char' should be preceded by ';'
1>d:\work\eblearn\eblearn-1.1\core\libidx\include\idxops.hpp(1464): fatal error C1903: unable to recover from previous error(s); stopping compilation


Can anybody help me out what is wrong with it?

Any suggestion will be greatly appreciated


Best regards


Sunny

the_minion

unread,
Oct 12, 2012, 5:25:40 PM10/12/12
to ebl...@googlegroups.com
Hey Sunny,

Can you show me your entire code? There seems to be nothing wrong with those lines pointed out by the VS2010 compiler, if you show me minimal code that will reproduce the error, i can take a look.

Tianxu Jia

unread,
Oct 13, 2012, 4:32:06 AM10/13/12
to ebl...@googlegroups.com
Message has been deleted

Tianxu Jia

unread,
Oct 13, 2012, 4:37:37 AM10/13/12
to ebl...@googlegroups.com

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

Reply all
Reply to author
Forward
0 new messages