Ask Your Question

Build opencv 3.1 with Visual Studio 2008

asked 2016-04-14 02:50:11 -0500

pollausen85 gravatar image

I'm trying to build Opencv 3.1 with Visual Studio 2008 but I get some errors as:

  • stdint.h not found

  • __cpuidex not defined

  • data() is not a member function of std::vector

Is it possible buld Opencv 3.1 with VS2008? If yes, what do I have to do? If no, which is the last version compatible with VS2008? Thanks!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-04-14 03:12:15 -0500

berak gravatar image

updated 2016-04-14 07:18:58 -0500

opencv still builds with vs2008 ! ;)

please get latest master from github (this will fix the cpuidex and data() issue) , and stdint.h from e.g. here, put it into VC/include (your compilers include dir) .

you will have to disable IPP, cmake -DWITH_IPP=OFF

building opencv, you'll see some warnings about multiple WCHAR definitions, but that's unavoidable.

edit flag offensive delete link more


With your help I solved errors related to stdint.h and data(), but I still have the error about the __cpuidex and the problem is in modules\core\src\system.cpp. Do you have other suggestions?

pollausen85 gravatar imagepollausen85 ( 2016-04-14 08:57:46 -0500 )edit
berak gravatar imageberak ( 2016-04-14 09:07:30 -0500 )edit

My OS is 64bit but I'm trying to compile x86.

pollausen85 gravatar imagepollausen85 ( 2016-04-14 09:21:16 -0500 )edit

can we get the complete error ?

maybe you should make an issue here

berak gravatar imageberak ( 2016-04-14 09:26:15 -0500 )edit

This is the complete error: ..\..\..\Development\lib\OpenCV3.1\opencv-master\modules\core\src\system.cpp(298) : error C3861: '__cpuidex': identifier not found and specific line is:

#if defined _MSC_VER && (defined _M_IX86 || defined _M_X64)
        __cpuidex(cpuid_data, 7, 0);

In my case _MSC_VER = 1500 and _M_IX86 = 600.

pollausen85 gravatar imagepollausen85 ( 2016-04-14 09:44:58 -0500 )edit

then i'd say, it's a bug. (there should be code for the _M_X64 __cpuidex case, but there is no such thing here

berak gravatar imageberak ( 2016-04-14 09:49:31 -0500 )edit

Thanks! In order to report this bug should I follow the link you posted above?

pollausen85 gravatar imagepollausen85 ( 2016-04-14 10:12:52 -0500 )edit

yes, -

(but, with a grain of salt, -- VS2008 is absolutely low priority, they have no more a buildbot for this, so a fix might take a while)

berak gravatar imageberak ( 2016-04-14 10:15:49 -0500 )edit

As a workaround I surrounded the __cpuidex call with:

#if _MSC_VER >=1600
   __cpuidex(cpuid_data, 7, 0);

In this way since in my case _MSC_VER = 1500 the compiler skip this call, and I was able to compile successfully.

pollausen85 gravatar imagepollausen85 ( 2016-04-14 11:06:48 -0500 )edit

answered 2017-02-07 17:29:35 -0500

Hi all, I just cloned the latest source code from git, checked out the 3.2.0 tag, CMake runs with no issues, I also disabled the IPP like mentioned above, copied the stdint.h file to VC/include folder, but I'm getting lots of errors. Is the 3.2.0 still compilable with VS2008?

edit flag offensive delete link more


Well, I checked out tag and it compiles beautifully with VS2008 so I'll stick to that for now...

pedro_nf gravatar imagepedro_nf ( 2017-02-08 10:08:39 -0500 )edit

Question Tools

1 follower


Asked: 2016-04-14 02:50:11 -0500

Seen: 1,102 times

Last updated: Feb 07 '17