[1/2] Add missing <string> header

Submitted by Christophe de Dinechin on Feb. 16, 2018, 3:23 p.m.

Details

Message ID 20180216152306.25482-2-christophe@dinechin.org
State New
Headers show
Series "Warning and build error fixes" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Christophe de Dinechin Feb. 16, 2018, 3:23 p.m.
From: Christophe de Dinechin <dinechin@redhat.com>

Without this header, clang complains with messages such as:

concrete-agent.cpp:62:37: error: invalid operands to binary expression ('const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char> >') and 'const char *')
    std::string pattern = directory + "/*.so";
                          ~~~~~~~~~ ^ ~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iterator:743:1: note: candidate template ignored: could not match 'reverse_iterator<type-parameter-0-0>' against 'char const[6]'
operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x)
^

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
---
 src/concrete-agent.cpp | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp
index 891c09b..ac37788 100644
--- a/src/concrete-agent.cpp
+++ b/src/concrete-agent.cpp
@@ -9,6 +9,7 @@ 
 #include <syslog.h>
 #include <glob.h>
 #include <dlfcn.h>
+#include <string>
 
 #include "concrete-agent.hpp"
 #include "static-plugin.hpp"

Comments

> 
> From: Christophe de Dinechin <dinechin@redhat.com>
> 
> Without this header, clang complains with messages such as:
> 
> concrete-agent.cpp:62:37: error: invalid operands to binary expression
> ('const std::string' (aka 'const basic_string<char, char_traits<char>,
> allocator<char> >') and 'const char *')
>     std::string pattern = directory + "/*.so";
>                           ~~~~~~~~~ ^ ~~~~~~~
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iterator:743:1:
> note: candidate template ignored: could not match
> 'reverse_iterator<type-parameter-0-0>' against 'char const[6]'
> operator+(typename reverse_iterator<_Iter>::difference_type __n, const
> reverse_iterator<_Iter>& __x)
> ^
> 
> Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
> ---
>  src/concrete-agent.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp
> index 891c09b..ac37788 100644
> --- a/src/concrete-agent.cpp
> +++ b/src/concrete-agent.cpp
> @@ -9,6 +9,7 @@
>  #include <syslog.h>
>  #include <glob.h>
>  #include <dlfcn.h>
> +#include <string>
>  
>  #include "concrete-agent.hpp"
>  #include "static-plugin.hpp"

Acked.

I suppose on clang the std::string is defined in another header.
Is weird that got basic_string and std::string declarations but not
its operators.

Frediano