Author Topic: Problem with OpenCV 2.0 in windows  (Read 10562 times)

Offline rodrigozanatta

  • Single posting newcomer
  • *
  • Posts: 2
Problem with OpenCV 2.0 in windows
« on: October 28, 2010, 01:49:57 am »
Hi, I am trying run a program in Code::Block v10.05 using the OpenCV 2.0 lib.

I make the exact instruction in this wiki page. With this I can run a simple program that show a image with C language. I used the 2.0 version, but same files are a little diferrent in wiki page.

Anyway, I try to run a C++ program, a very simple #include <cv.hpp> line cause trouble. It show this:
Code
C:\OpenCV2.0\include\opencv\cv.hpp|51|error: `IPL_BORDER_REPLICATE' was not declared in this scope|
C:\OpenCV2.0\include\opencv\cv.hpp|51|error: enumerator value for `BORDER_REPLICATE' not integer constant|
C:\OpenCV2.0\include\opencv\cv.hpp|51|error: `IPL_BORDER_CONSTANT' was not declared in this scope|
C:\OpenCV2.0\include\opencv\cv.hpp|51|error: enumerator value for `BORDER_CONSTANT' not integer constant|
C:\OpenCV2.0\include\opencv\cv.hpp|52|error: `IPL_BORDER_REFLECT' was not declared in this scope|
C:\OpenCV2.0\include\opencv\cv.hpp|52|error: enumerator value for `BORDER_REFLECT' not integer constant|
C:\OpenCV2.0\include\opencv\cv.hpp|52|error: `IPL_BORDER_REFLECT_101' was not declared in this scope|
C:\OpenCV2.0\include\opencv\cv.hpp|52|error: enumerator value for `BORDER_REFLECT_101' not integer constant|
C:\OpenCV2.0\include\opencv\cv.hpp|53|error: `IPL_BORDER_WRAP' was not declared in this scope|
C:\OpenCV2.0\include\opencv\cv.hpp|53|error: enumerator value for `BORDER_WRAP' not integer constant|
C:\OpenCV2.0\include\opencv\cv.hpp|56|error: expected constructor, destructor, or type conversion before "int"|
C:\OpenCV2.0\include\opencv\cv.hpp|59|error: invalid function declaration|
C:\OpenCV2.0\include\opencv\cv.hpp|70|error: invalid function declaration|
C:\OpenCV2.0\include\opencv\cv.hpp|82|error: invalid function declaration|
C:\OpenCV2.0\include\opencv\cv.hpp|95|error: invalid function declaration|
C:\OpenCV2.0\include\opencv\cv.hpp|150|error: expected `,' or `...' before '&' token|
C:\OpenCV2.0\include\opencv\cv.hpp|150|error: extraneous `int' ignored|
C:\OpenCV2.0\include\opencv\cv.hpp|150|error: ISO C++ forbids declaration of `Mat' with no type|
C:\OpenCV2.0\include\opencv\cv.hpp|152|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|156|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|161|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|166|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|173|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|178|error: `Mat' does not name a type|
C:\OpenCV2.0\include\opencv\cv.hpp|180|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|184|error: two or more data types in declaration of `getDerivKernels'|
C:\OpenCV2.0\include\opencv\cv.hpp|184|error: variable `cv::CV_EXPORTS cv::getDerivKernels' has initializer but incomplete type|
C:\OpenCV2.0\include\opencv\cv.hpp|184|error: `Mat' was not declared in this scope|
C:\OpenCV2.0\include\opencv\cv.hpp|184|error: `kx' was not declared in this scope|
C:\OpenCV2.0\include\opencv\cv.hpp|184|error: `Mat' was not declared in this scope|
C:\OpenCV2.0\include\opencv\cv.hpp|184|error: `ky' was not declared in this scope|
C:\OpenCV2.0\include\opencv\cv.hpp|184|error: expected primary-expression before "int"|
C:\OpenCV2.0\include\opencv\cv.hpp|184|error: expected primary-expression before "int"|
C:\OpenCV2.0\include\opencv\cv.hpp|184|error: expected primary-expression before "int"|
C:\OpenCV2.0\include\opencv\cv.hpp|185|error: expected primary-expression before "bool"|
C:\OpenCV2.0\include\opencv\cv.hpp|185|error: expected primary-expression before "int"|
C:\OpenCV2.0\include\opencv\cv.hpp|187|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|191|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|193|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|196|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|204|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|205|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|206|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|209|error: `Scalar' does not name a type|
C:\OpenCV2.0\include\opencv\cv.hpp|211|error: expected initializer before '<' token|
C:\OpenCV2.0\include\opencv\cv.hpp|217|error: `Mat' does not name a type|
C:\OpenCV2.0\include\opencv\cv.hpp|219|error: expected `,' or `...' before '&' token|
C:\OpenCV2.0\include\opencv\cv.hpp|221|error: two or more data types in declaration of `copyMakeBorder'|
C:\OpenCV2.0\include\opencv\cv.hpp|221|error: ISO C++ forbids declaration of `Mat' with no type|
C:\OpenCV2.0\include\opencv\cv.hpp|223|error: expected `,' or `...' before '&' token|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

And my program is only this:

Code
#include <iostream>
#include <cv.hpp>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

Why this happnes? What wrong I do? F*ck.. Why this don“t work. I really need this, and i only whant to run this program, is only this that i will use the C++ language. Anyone know?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7785
    • My Best Post
Re: Problem with OpenCV 2.0 in windows
« Reply #1 on: October 28, 2010, 05:36:00 am »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Problem with OpenCV 2.0 in windows
« Reply #2 on: October 28, 2010, 06:12:58 am »
the wiki CodeBlocks - OpenCV Wiki page was mainly edited by me.  :D
And I suggest follow a simple opencv example instead of just create a one and include any include files you thought is correct.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.