Compiler errors and solutions for C + + Minicsv libraries _c language

Source: Internet
Author: User

There is a project that needs to write a CSV file to render the data. GitHub has a lightweight read and write library about CSV minicsv, so download it. However, the following problems occurred while compiling the example:

In the file included from example.cpp:1:0:
minicsv.hpp:In function ' csv::ofstream& operator<< (csv::ofstream&, const t&) ':
Minicsv.hpp:326:38:error:no matching function for call to ' Csv::ofstream::escape_and_output (std::basic_ostringstream <char>::__string_type) '
Ostm.escape_and_output (Os_temp.str ());
^
Minicsv.hpp:326:38:note:candidate is:
Minicsv.hpp:266:8: Note:void csv::ofstream::escape_and_output (std::string&)
void Escape_and_output (std::string & SRC)

...

A lot of mistakes, no longer posted, occupy space. All of these errors come from the same function header. This function header is defined in this way:

    void Escape_and_output (std::string & SRC)

And the call is like this:

    Ostm.escape_and_output (Os_temp.str ());

Obviously, the function header required by the call is a reference to the right value, and the true function header gives a reference to the left value, which does not match, and the compiler complains. The modification is very simple, "&" changed to "&" can be, that is, to change the head of the function to look like this:
void Escape_and_output (std::string & src)
Error very water, would not want to Write out, but also afraid of c++0x unfamiliar people will be overwhelmed, so paste it. And I don't know why there's such an obvious mistake in the project-maybe the boss's compiler is too smart.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.