1

I'm working on [Bjarne_Stroustrup]Programming-Principles-and-Practice-Using-C++ book. I tried to compile the classic first program:

#include "std_lib_facilities.h"
int main()
{
        cout << "Hello, World!\n";
        return 0;
}

by:

g++ theClassicFirstProgram.C -o theClassicFirstProgram

and I received this error:

In file included from /usr/include/c++/7/locale:41:0,
                 from /usr/include/c++/7/iomanip:43,
                 from std_lib_facilities.h:212,
                 from p45-theClassicFirstProgram.C:2:
/usr/include/c++/7/bits/locale_facets_nonio.h:1971:5: error: template-id ‘do_get<>’ for ‘String std::__cxx11::messages<char>::do_get(std::messages_base::catalog, int, int, const String&) const’ does not match any template declaration
     messages<char>::do_get(catalog, int, int, const string&) const;
     ^~~~~~~~~~~~~~
/usr/include/c++/7/bits/locale_facets_nonio.h:1971:62: note: saw 1 ‘template<>’, need 2 for specializing a member function template
     messages<char>::do_get(catalog, int, int, const string&) const;

I also tried the flags -std=c++11 and -std=c++0x with receiving the same error.
It should be noted that the file std_lib_facilites.h is downloaded (from here) and placed in the source code directory. Thanks.

Naghi
  • 145
  • 5

0 Answers0