Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Nov 2016 10:39:08 -0300
From:      =?UTF-8?B?T3RhY8OtbGlv?= <otacilio.neto@bsd.com.br>
To:        Pietro Cerutti <gahr@FreeBSD.org>
Cc:        freebsd-ports@freebsd.org, owner-freebsd-ports@freebsd.org
Subject:   Re: How compile "String inf = static_cast<ostringstream*>(&(ostringstream() << pAct.minArea))->str();"
Message-ID:  <eba49b50-fd4e-1bd0-fd41-d67424cebb96@bsd.com.br>
In-Reply-To: <d6f25afe1529486ce23d1d0945e87464@FreeBSD.org>
References:  <ebbf89d2-f83a-b03a-95db-05c7d5358aa7@bsd.com.br> <d6f25afe1529486ce23d1d0945e87464@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Em 14/11/2016 06:29, Pietro Cerutti escreveu:
> On 2016-11-09 02:37, OtacĂ­lio wrote:
>> I'm trying create a patch to OpenCV 3.1 runs on FreeBSD but clang
>> don't compiles lines like this:
>>
>> String inf = static_cast<ostringstream*>(&(ostringstream() <<
>> pAct.minArea))->str();
>
> There's nothing wrong with this code, provided that:
>
> * <sstream> is included
> * ostringstream is actually std::ostringstream
> * pAct.minArea defines operator<< to std::ostringstream or one of its 
> base classes
>
> What's the error you're getting?
>
> That being said, I'd switch to using c++11 and String inf = 
> std::to_string(pAct.minArea) :)
>

Hi

This code is in 
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp 
line 76 . I'm using C++11. The full compiler error message is this:


[ 95%] Built target example_image_sequence
--- samples/cpp/CMakeFiles/example_select3dobj.dir/all ---
/usr/bin/make -f 
samples/cpp/CMakeFiles/example_select3dobj.dir/build.make 
samples/cpp/CMakeFiles/example_select3dobj.dir/depend
--- samples/cpp/CMakeFiles/example_select3dobj.dir/depend ---
cd /usr/ports/graphics/opencv3/work/opencv-3.1.0 && /usr/local/bin/cmake 
-E cmake_depends "Unix Makefiles" 
/usr/ports/graphics/opencv3/work/opencv-3.1.0 
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp 
/usr/ports/graphics/opencv3/work/opencv-3.1.0 
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp 
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/CMakeFiles/example_select3dobj.dir/DependInfo.cmake 
--color=
--- samples/cpp/CMakeFiles/example_detect_mser.dir/all ---
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:76:46: 
error: cannot take the address of an rvalue of type 
'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >'
     String inf = static_cast<ostringstream*>(&(ostringstream() << 
pAct.minArea))->str();
                                              ^ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:77:46: 
error: cannot take the address of an rvalue of type 
'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >'
     String sup = static_cast<ostringstream*>(&(ostringstream() << 
pAct.maxArea))->str();
                                              ^ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:80:39: 
error: cannot take the address of an rvalue of type 
'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >'
     inf = static_cast<ostringstream*>(&(ostringstream() << 
pAct.delta))->str();
                                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:82:39: 
error: cannot take the address of an rvalue of type 
'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >'
     inf = static_cast<ostringstream*>(&(ostringstream() << 
pAct.maxVariation))->str();
                                       ^ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:84:39: 
error: cannot take the address of an rvalue of type 
'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >'
     inf = static_cast<ostringstream*>(&(ostringstream() << 
(int)pAct.minDiversity))->str();
                                       ^ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:86:39: 
error: cannot take the address of an rvalue of type 
'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >'
     inf = static_cast<ostringstream*>(&(ostringstream() << 
(int)pAct.pass2Only))->str();
                                       ^ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:88:39: 
error: cannot take the address of an rvalue of type 
'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >'
     inf = static_cast<ostringstream*>(&(ostringstream() << 
(int)pAct.maxEvolution))->str();
                                       ^ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:90:39: 
error: cannot take the address of an rvalue of type 
'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >'
     inf = static_cast<ostringstream*>(&(ostringstream() << 
(int)pAct.areaThreshold))->str();
                                       ^ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:92:39: 
error: cannot take the address of an rvalue of type 
'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >'
     inf = static_cast<ostringstream*>(&(ostringstream() << 
(int)pAct.minMargin))->str();
                                       ^ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:94:39: 
error: cannot take the address of an rvalue of type 
'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >'
     inf = static_cast<ostringstream*>(&(ostringstream() << 
(int)pAct.edgeBlurSize))->str();
                                       ^ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?eba49b50-fd4e-1bd0-fd41-d67424cebb96>