From owner-freebsd-ports@freebsd.org Mon Nov 14 13:39:16 2016 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A2D9C3F65C for ; Mon, 14 Nov 2016 13:39:16 +0000 (UTC) (envelope-from otacilio.neto@bsd.com.br) Received: from mail-qk0-x22a.google.com (mail-qk0-x22a.google.com [IPv6:2607:f8b0:400d:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1328C104B for ; Mon, 14 Nov 2016 13:39:16 +0000 (UTC) (envelope-from otacilio.neto@bsd.com.br) Received: by mail-qk0-x22a.google.com with SMTP id n204so95212437qke.2 for ; Mon, 14 Nov 2016 05:39:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsd.com.br; s=capeta; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=nK7YZfus3dnF7w1IqC7nLv03XSmhMUEdWxAHzxJudB4=; b=HJ+JKQypsYF+bVgaV199NaMq2z1i4PSckAfZrujD1kLIF+p4ISALp5hqYZsqO9nKav 2J6rZvSaW5oMQni4EdNwP63vRKk+WV1Yp0jAVouzbuoeW8plzN4/bRFHEJGbmmah8QPQ 4OtXGCRg/QeSkymrb/oAx5DN9T3RqbpzuGRME= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=nK7YZfus3dnF7w1IqC7nLv03XSmhMUEdWxAHzxJudB4=; b=YVe1AnIUEzzVsOzoPEnfI3+6hN8B3rIYzMpHRbRVF51Xeqbt2FwuXSyd+k8FItxlGp FnMhl/5bldYRD/UCPwz4kbHasexmEE1Zzaj39X4OL5tFDS32U+hpBn7ArwGlE5KgTYMk 3Obyn+nbIw08a4l+CYNbRgCBQTcEAxuYsALKKGQ44iOIyeJx79Hzk71/rQqkbFRdhHvj UF5YRIHPmsXeT0te5ec5o9KzNiZ0ZLZ+nwDsXIj1aKLFTw5G402G0ziL1q7kXTbVrPLp RSvmLsup3/I8N6cgzySybzG8fGwRear/ZaMEpjqEN5WvFbyKE8z5TH1fqKGtlsgU2xru kzMw== X-Gm-Message-State: ABUngvfPGFNBdAw41Y2dWSyc+KfkLccyUyXMssp0+F6JmeUByPWLSoga4WK+qK3jdG0arw== X-Received: by 10.55.203.22 with SMTP id d22mr18338659qkj.240.1479130755151; Mon, 14 Nov 2016 05:39:15 -0800 (PST) Received: from [10.50.213.112] ([177.20.152.129]) by smtp.googlemail.com with ESMTPSA id k16sm12451866qtc.22.2016.11.14.05.39.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Nov 2016 05:39:14 -0800 (PST) Subject: Re: How compile "String inf = static_cast(&(ostringstream() << pAct.minArea))->str();" To: Pietro Cerutti References: Cc: freebsd-ports@freebsd.org, owner-freebsd-ports@freebsd.org From: =?UTF-8?B?T3RhY8OtbGlv?= Message-ID: Date: Mon, 14 Nov 2016 10:39:08 -0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Nov 2016 13:39:16 -0000 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() << >> pAct.minArea))->str(); > > There's nothing wrong with this code, provided that: > > * 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, std::__1::allocator >' String inf = static_cast(&(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, std::__1::allocator >' String sup = static_cast(&(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, std::__1::allocator >' inf = static_cast(&(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, std::__1::allocator >' inf = static_cast(&(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, std::__1::allocator >' inf = static_cast(&(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, std::__1::allocator >' inf = static_cast(&(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, std::__1::allocator >' inf = static_cast(&(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, std::__1::allocator >' inf = static_cast(&(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, std::__1::allocator >' inf = static_cast(&(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, std::__1::allocator >' inf = static_cast(&(ostringstream() << (int)pAct.edgeBlurSize))->str(); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~