Ask Your Question
0

Why I'm getting this error message? /usr/local/include/opencv2/core/utility.hpp:362:47: error: reinterpret_cast from 'nullptr_t' to 'int *' is not allowed

asked 2016-11-07 07:10:24 -0600

ota gravatar image

updated 2016-11-09 06:20:50 -0600

Dears

I'm trying a port of opencv 3.1 in FreeBSD 11 with clang 3.8. When I compile a minimalist program like this:

#include <opencv2/opencv.hpp>

int main(){
    cv::Mat myMat;

    return 0;
}

with c++11 or above enabled, I get this error message:

[ota@nostromo /usr/home/ota/Desktop]$ c++ -I/usr/local/include -L/usr/local/lib -o main main.cpp -lopencv_core -std=c++11
In file included from main.cpp:1:
In file included from /usr/local/include/opencv2/opencv.hpp:46:
In file included from /usr/local/include/opencv2/core.hpp:3165:
/usr/local/include/opencv2/core/utility.hpp:362:47: error: reinterpret_cast from
      'nullptr_t' to 'int *' is not allowed
        operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(NULL));
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

When open the file this warning is there:

template<typename _Tp, typename Functor> inline
void Mat::forEach_impl(const Functor& operation) {
    if (false) {
        operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(NULL));
        // If your compiler fail in this line.
        // Please check that your functor signature is
        //     (_Tp&, const int*)   <- multidimential
        //  or (_Tp&, void*)        <- in case of you don't need current idx.
        }

Why I'm getting this error? My program is only a toy program. How to fix it?

edit retag flag offensive close merge delete

Comments

2

it looks different here:

if (false) {
    operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(0));

maybe you should try to change NULL to 0 manually, or update to latest github master (and build from src)

berak gravatar imageberak ( 2016-11-07 07:49:56 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2016-11-09 07:45:54 -0600

berak gravatar image

so, official answer: this is a bug, that was fixed in recent opencv master branch.

either apply patch manually, or, rather update to latest master branch via git and rebuild from source.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-11-07 07:10:24 -0600

Seen: 508 times

Last updated: Nov 09 '16