Discussion:
OpenCV with Borland
ryba19831405
2006-11-14 08:39:53 UTC
Permalink
Hi,
I am a student of technical university in Poland and I am traying to
use OpenCV in one of my projects. I am using Borland Dev Studio
2006(C++ Builder). I download the latest 1.0 version of OpenCV. Can
somebody help me how to install it and how to use it in DevStudio? I
think that after installation I must add same paths in
Project>DefaultOptions:
C++Compiler(bcc32)->Paths and Defines and
in Linker(ilink32)->Paths and Defines.
But what paths? I created a sample project but it didn't compile.

With best regards
Wojtek Debowski
winchymatt
2006-11-14 22:40:26 UTC
Permalink
Hi, I'm using OpenCv V1.0 with borland builder 5. I had to convert the
LIB files for use with builder, and add the head file directories to
the project.

Include Dires.

C:\Program Files\OpenCV\cxcore\include\
C:\Program Files\OpenCV\otherlibs\highgui\
C:\Program Files\OpenCV\otherlibs\cvcam\include\
C:\Program Files\OpenCV\cv\include\

Lib Dirs. ( this is the converted libs I created using coff2omf.exe )

C:\Program Files\OpenCV\borlib\cvt\

Then add the relevent LIBs and Files into your project using the
project manager.

Hope this helps.
Post by ryba19831405
Hi,
I am a student of technical university in Poland and I am traying to
use OpenCV in one of my projects. I am using Borland Dev Studio
2006(C++ Builder). I download the latest 1.0 version of OpenCV. Can
somebody help me how to install it and how to use it in DevStudio? I
think that after installation I must add same paths in
C++Compiler(bcc32)->Paths and Defines and
in Linker(ilink32)->Paths and Defines.
But what paths? I created a sample project but it didn't compile.
With best regards
Wojtek Debowski
Lorenzo Monti
2006-11-16 09:36:24 UTC
Permalink
I prefer to use #pragma link directives rather than adding lib files to
the project, because you can conditionally link.
Eg:
#ifdef _DEBUG
#pragma link "mylibd.lib"
#else
#pragma link "mylib.lib"
#endif
You cannot do such things if you add lib files to the project using
project manager.
Another suggestion, if you are using the precompiled version of opencv,
enable the Microsoft Visual C++ compatibility (-VM) and MFC
compatibility (-VF) switches in the compiler (the former does not have a
corresponding checkbox, you have to specify it manually in "Othe options
/ Additional options".
Otherwise you will face troubles when calling cvGetSize and a couple of
other functions.
ciao
- Lorenzo -
Post by winchymatt
Hi, I'm using OpenCv V1.0 with borland builder 5. I had to convert the
LIB files for use with builder, and add the head file directories to
the project.
Include Dires.
C:\Program Files\OpenCV\cxcore\include\
C:\Program Files\OpenCV\otherlibs\highgui\
C:\Program Files\OpenCV\otherlibs\cvcam\include\
C:\Program Files\OpenCV\cv\include\
Lib Dirs. ( this is the converted libs I created using coff2omf.exe )
C:\Program Files\OpenCV\borlib\cvt\
Then add the relevent LIBs and Files into your project using the
project manager.
Hope this helps.
Post by ryba19831405
Hi,
I am a student of technical university in Poland and I am traying to
use OpenCV in one of my projects. I am using Borland Dev Studio
2006(C++ Builder). I download the latest 1.0 version of OpenCV. Can
somebody help me how to install it and how to use it in DevStudio? I
think that after installation I must add same paths in
C++Compiler(bcc32)->Paths and Defines and
in Linker(ilink32)->Paths and Defines.
But what paths? I created a sample project but it didn't compile.
With best regards
Wojtek Debowski
Lorenzo Monti
2006-11-16 09:41:41 UTC
Permalink
Sorry, I made a mistake.
The -VM switch *does* have a checkbox.
The -VF switch does *NOT* have one and must be specified manually.

==========================-------------------------==============================

I prefer to use #pragma link directives rather than adding lib files to
the project, because you can conditionally link.
Eg:
#ifdef _DEBUG
#pragma link "mylibd.lib"
#else
#pragma link "mylib.lib"
#endif
You cannot do such things if you add lib files to the project using
project manager.
Another suggestion, if you are using the precompiled version of opencv,
enable the Microsoft Visual C++ compatibility (-VM) and MFC
compatibility (-VF) switches in the compiler (the former does not have a
corresponding checkbox, you have to specify it manually in "Othe options
/ Additional options".
Otherwise you will face troubles when calling cvGetSize and a couple of
other functions.
ciao
- Lorenzo -
Post by winchymatt
Hi, I'm using OpenCv V1.0 with borland builder 5. I had to convert the
LIB files for use with builder, and add the head file directories to
the project.
Include Dires.
C:\Program Files\OpenCV\cxcore\include\
C:\Program Files\OpenCV\otherlibs\highgui\
C:\Program Files\OpenCV\otherlibs\cvcam\include\
C:\Program Files\OpenCV\cv\include\
Lib Dirs. ( this is the converted libs I created using coff2omf.exe )
C:\Program Files\OpenCV\borlib\cvt\
Then add the relevent LIBs and Files into your project using the
project manager.
Hope this helps.
Post by ryba19831405
Hi,
I am a student of technical university in Poland and I am traying to
use OpenCV in one of my projects. I am using Borland Dev Studio
2006(C++ Builder). I download the latest 1.0 version of OpenCV. Can
somebody help me how to install it and how to use it in DevStudio? I
think that after installation I must add same paths in
C++Compiler(bcc32)->Paths and Defines and
in Linker(ilink32)->Paths and Defines.
But what paths? I created a sample project but it didn't compile.
With best regards
Wojtek Debowski
ryba19831405
2006-11-16 13:09:47 UTC
Permalink
Hi,
thank you for help, I have installed OpenCV with succes.
I switched on checkbox -VM in C++ Compiler->source, and in
C++ Compiler->Other Options I switched on checkbox additonal options
and write -VF as you said, but I still have error after running
program with cvGetSize - "Array should be CvMat or IplImage in
function cvGetSize - cxcore\src\cxarray.cpp(1453)". I have no idea how
to fix it? Can you help me?

With best regards
Wojtek
Lorenzo Monti
2006-11-16 13:57:54 UTC
Permalink
opencv dll's you are using are those from binary distribution, or have
you rebuilt them from sources?
if you built opencv from source, the dll's are already
borland-compatible without the -VM and -VF switches.
try to clean obj files and rebuild your project.
do you have more than one version of opencv installed? verify that you
are loading the correct version. you can copy dll's from opencv bin
subdir to the path of your program: they will be given precedence when
loading dll's at program startup.
post your code, maybe the error is there.
Post by ryba19831405
Hi,
thank you for help, I have installed OpenCV with succes.
I switched on checkbox -VM in C++ Compiler->source, and in
C++ Compiler->Other Options I switched on checkbox additonal options
and write -VF as you said, but I still have error after running
program with cvGetSize - "Array should be CvMat or IplImage in
function cvGetSize - cxcore\src\cxarray.cpp(1453)". I have no idea how
to fix it? Can you help me?
With best regards
Wojtek
ryba19831405
2006-11-16 14:42:34 UTC
Permalink
Sorry, I have made a mistake in my code,everything is ok with
cvGetSize
Lorenzo Monti
2006-11-16 14:54:28 UTC
Permalink
;))))))
happy opencv'ing with great borland tools!
ciao
Post by ryba19831405
Sorry, I have made a mistake in my code,everything is ok with
cvGetSize
ryba19831405
2006-11-14 22:03:25 UTC
Permalink
I added in both these categories all these paths:
$(BDS)\OpenCV
$(BDS)\OpenCV\lib
$(BDS)\OpenCV\bin
$(BDS)\OpenCV\cv\include
$(BDS)\OpenCV\cv\src
$(BDS)\OpenCV\cxcore\include
$(BDS)\OpenCV\cxcore\src
$(BDS)\OpenCV\cvaux\include
$(BDS)\OpenCV\cvaux\src
$(BDS)\OpenCV\otherlibs\highgui
$(BDS)\OpenCV\otherlibs\cvcam\include
$(BDS)\OpenCV\otherlibs\cvcam\src\windows
I created a sample project. It passed compilation process,
but failed linking, I had linker error-unresolved external with all
functions I used in source file. Why linker didn't find these
functions? Can somebody help me?
jromero72.geo
2006-11-15 16:49:38 UTC
Permalink
Make sure the name of the functions is correct. I think I had a
similar problem because of the underscore prepended to the function's
names. Try using a "_" in fron of one of your functions and compile to
see if that solves the problem.

I think the "_" is added by coff2omf, but I couldn't find the right
setting to avoid it.

JR
Post by ryba19831405
$(BDS)\OpenCV
$(BDS)\OpenCV\lib
$(BDS)\OpenCV\bin
$(BDS)\OpenCV\cv\include
$(BDS)\OpenCV\cv\src
$(BDS)\OpenCV\cxcore\include
$(BDS)\OpenCV\cxcore\src
$(BDS)\OpenCV\cvaux\include
$(BDS)\OpenCV\cvaux\src
$(BDS)\OpenCV\otherlibs\highgui
$(BDS)\OpenCV\otherlibs\cvcam\include
$(BDS)\OpenCV\otherlibs\cvcam\src\windows
I created a sample project. It passed compilation process,
but failed linking, I had linker error-unresolved external with all
functions I used in source file. Why linker didn't find these
functions? Can somebody help me?
Lorenzo Monti
2006-11-16 09:13:39 UTC
Permalink
add these lines to one of the cpp files in your project:
#pragma link cv.lib
#pragma link cxcore.lib
etc. etc.
remember to convert .lib files from COFF to OMF (unless you built opencv
from sources using BCC, in wich case your lib files are already OMF).
use COFF2OMF tool to do the conversion.
ciao
- Lorenzo -
Post by jromero72.geo
Make sure the name of the functions is correct. I think I had a
similar problem because of the underscore prepended to the function's
names. Try using a "_" in fron of one of your functions and compile to
see if that solves the problem.
I think the "_" is added by coff2omf, but I couldn't find the right
setting to avoid it.
JR
Post by ryba19831405
$(BDS)\OpenCV
$(BDS)\OpenCV\lib
$(BDS)\OpenCV\bin
$(BDS)\OpenCV\cv\include
$(BDS)\OpenCV\cv\src
$(BDS)\OpenCV\cxcore\include
$(BDS)\OpenCV\cxcore\src
$(BDS)\OpenCV\cvaux\include
$(BDS)\OpenCV\cvaux\src
$(BDS)\OpenCV\otherlibs\highgui
$(BDS)\OpenCV\otherlibs\cvcam\include
$(BDS)\OpenCV\otherlibs\cvcam\src\windows
I created a sample project. It passed compilation process,
but failed linking, I had linker error-unresolved external with all
functions I used in source file. Why linker didn't find these
functions? Can somebody help me?
Continue reading on narkive:
Loading...