Build opencv in windows

asked 2018-06-28 06:04:34 -0600

updated 2018-06-28 07:15:06 -0600

berak gravatar image

Hey All

I installed codeblocks(17.12 with mingw) and extract opencv(4.3.1) and cmake(3.11.1) it in Windows.

Now i want to build the opencv.cbp

I see many error from codeblocks because cant compile code and codes need edit . Is this usual?

see this , i have this error in codeblocks too

edit retag flag offensive close merge delete

Comments

please, no screenshots of code or errormsgs. replace those with a TEXT version,

if you're using mingw, which version is it ? (codeblock's is usually too old)

try a g++ -v and report back.

codes need edit

for heaven's sake NOOOOO

opencv(4.3.1)

does not exist. you probably mean 3.4.1 ?

berak gravatar imageberak ( 2018-06-28 06:54:58 -0600 )edit

you can add BUILD_TESTS=OFF to the cmake params, but i guess, you need to install a a more modern gcc

berak gravatar imageberak ( 2018-06-28 08:38:06 -0600 )edit

yes ( 3.4.1 ) . the newest version of codeblocks is 17.12 . i use version 5.1 ( mingw ) this is not a my code . its a library from opencv and you can see all file in opencv . how can try g++ -v ? tnx

Ngelo.simon gravatar imageNgelo.simon ( 2018-06-28 08:41:04 -0600 )edit

you open a console window and type that.

but 5.1 is a number that makes sense, so it's probably that.

this is not a my code

yes, i know. it's from google's test suite. again, you can try to disable the build tests, but expect more problems. here are some nessecary cmake options for building with mingw:

  • ENABLE_PRECOMPILED_HEADERS=OFF
  • WITH_IPP=OFF
  • WITH_MSMF=OFF
  • CPU_DISPATCH= (leave it empty)

please also check, if you have a 32 or 64 bit version. if you run into problems, the 1st thing will probably be to swap your current mingw for latest mingw64 (7.2 or 7.3), which is somewhat proven to work here.

berak gravatar imageberak ( 2018-06-28 09:47:24 -0600 )edit

Hi break again I do all cmake option and i change my MinGW But i have the Errors Again . the first Error i see it : code :(<typename char_type> bool null_or_empty(const char_type* s) { return s == nullptr || *s == 0; }) Error : ( Build: all in OpenCV (compiler: GNU GCC Compiler) ===| D:\Program\Open Cv Modern\sources\3rdparty\protobuf\src\google\protobuf\stubs\io_win32.cc|94|warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]| D:\Program\Open Cv Modern\sources\3rdparty\protobuf\src\google\protobuf\stubs\io_win32.cc||In function 'bool google::protobuf::internal::win32::{anonymous}::null_or_empty(const char_type*)':| D:\Program\Open Cv Modern\sources\3rdparty\protobuf\src\google\protobuf\stubs\io_win32.cc|94|error: 'nullptr' was...)

Ngelo.simon gravatar imageNgelo.simon ( 2018-06-29 22:37:18 -0600 )edit

now i try to install another MinGW(w64) and feedback this .

Ngelo.simon gravatar imageNgelo.simon ( 2018-06-29 23:02:14 -0600 )edit

^^ yea, mingw 5.1 does not know c++11 by default

berak gravatar imageberak ( 2018-06-30 00:03:38 -0600 )edit

i cant donwload online mingw . i downloaded offline version 6.6 . i have error again . that error showing to me . i have no idea about this .

Ngelo.simon gravatar imageNgelo.simon ( 2018-06-30 01:39:38 -0600 )edit

version 6.6 have c++ 11 ? have link from offline mingw newer version ?

Ngelo.simon gravatar imageNgelo.simon ( 2018-06-30 01:42:56 -0600 )edit

you can try to add CMAKE_CXX_FLAGS="-std=c++11" to the cmake flags

or (better) try to get latest minngw64 from here

berak gravatar imageberak ( 2018-06-30 01:44:40 -0600 )edit