<p>You can view the source to the string class. I think its tstring.h or something. From what I remember it doesn&#39;t support the + operation like you are using.  I&#39;d just store artist album etc in a stdstring first before concatinating</p>

<div class="gmail_quote">On Jun 30, 2011 8:26 PM, &quot;Phong Cao&quot; &lt;<a href="mailto:phngcv@gmail.com">phngcv@gmail.com</a>&gt; wrote:<br type="attribution">&gt; Hello everybody,<br>&gt; <br>&gt; I am trying to use TagLib to extract tags from a stream and store it in a<br>
&gt; std::string. Here is the function I used:<br>&gt; <br>&gt; void TopWin::insert_tag_on_db(std::vector&lt;std::string&gt; &amp;filenames) {<br>&gt;   for (std::vector&lt;std::string&gt;::iterator iter = filenames.begin(); iter !=<br>
&gt; filenames.end(); ++iter) {<br>&gt;     TagLib::FileRef file((*iter).c_str());<br>&gt; <br>&gt;     if (!file.isNull() &amp;&amp; file.tag()) {<br>&gt;       TagLib::Tag *tag = file.tag();<br>&gt;       TagLib::AudioProperties *properties = file.audioProperties();<br>
&gt; <br>&gt;       int seconds = properties-&gt;length() % 60;<br>&gt;       int minutes = (properties-&gt;length() - seconds) / 60;<br>&gt; <br>&gt;       //error occurs here<br>&gt;       std::string insert = &quot;INSERT INTO SongList (track, name, genre,<br>
&gt; artist, album, time, uri) values (&quot; + tag-&gt;track() + &quot;, &#39;&quot; + tag-&gt;title() +<br>&gt; &quot;&#39;, &#39;&quot; + tag-&gt;genre() + &quot;&#39;, &#39;&quot; + tag-&gt;artist() + &quot;&#39;, &#39;&quot; + tag-&gt;album() + &quot;&#39;,<br>
&gt; &#39;&quot; + minutes + &quot;:&quot; + seconds + &quot;&#39;, &#39;&quot; + *iter + &quot;&#39;);&quot;;<br>&gt;     }<br>&gt;   }<br>&gt; }<br>&gt; <br>&gt; However, the program was not compiled. g++ reported an error:<br>
&gt; <br>&gt; /home/phongcao/dingo/topwin.cc:16: error: invalid operands of types ‘const<br>&gt; char*’ and ‘const char [4]’ to binary ‘operator+’<br>&gt; <br>&gt; I have read the TagLib documentation and it said that the TagLib&#39;s return<br>
&gt; type is TagLib::String. What I do not understand here is whether<br>&gt; TagLib::String is similar to std::string or char*? If it is similar to<br>&gt; std::string then what is the source of the above error?<br>&gt; <br>
&gt; I guess the source of the error is that I was trying to concatenate<br>&gt; tag-&gt;title(), tag-&gt;track(), etc... (which may have types char*, since I do<br>&gt; not know TagLib::String is a CString or a std::string) to a string literal.<br>
&gt; Can you guys suggest a solution to fix this error?<br>&gt; <br>&gt; <br>&gt; Thank you for reading my message! Have a good day!<br>&gt; <br>&gt; <br>&gt; Best regards,<br>&gt; <br>&gt; -- <br>&gt; Phong V. Cao<br>&gt; <a href="mailto:phngcv@gmail.com">phngcv@gmail.com</a><br>
&gt; <a href="mailto:caoph@rider.edu">caoph@rider.edu</a><br></div>