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(); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_______________________________________________
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"

Reply via email to