[patch] Removal of strfwd.h (was: When to use strfwd.h)

Enrico Forestieri forenr at lyx.org
Wed Oct 2 23:35:55 UTC 2024


On Thu, Oct 03, 2024 at 01:29:18AM +0200, Enrico Forestieri wrote:
>On Tue, Oct 01, 2024 at 11:01:15PM +0200, Pavel Sanda wrote:
>>
>>Enrico/Eugene/Stephan can you confirm you can compile and run master
>>with the attached patch?
>
>On cygwin compilation fails as follows:
>
>make[5]: Entering directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src/support'
>  CXX      trivstring.o
>In file included from ../../../src/support/trivstring.cpp:13:
>../../../src/support/../support/trivstring.h:41:22: error: ‘basic_string’ in namespace ‘std’ does not name a template type
>   41 |         typedef std::basic_string<Char, std::char_traits<Char>, std::allocator<Char> > _stdstring;
>      |                      ^~~~~~~~~~~~
>../../../src/support/../support/trivstring.h:17:1: note: 
>‘std::basic_string’ is defined in header ‘<string>’; did you forget to 
>‘#include <string>’?
>   16 | #include <cstdlib>
>  +++ |+#include <string>

And, after adding "#include <string>" to src/support/trivstring.h as 
suggested, it fails in this new way:

make[5]: Entering directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src/support'
   CXX      trivstring.o
In file included from /usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/string:44,
                  from ../../../src/support/../support/trivstring.h:17,
                  from ../../../src/support/trivstring.cpp:13:
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::__ostream_insert(basic_ostream<_CharT, _Traits>&, const _CharT*, streamsize) [with _CharT = unsigned int; _Traits = char_traits<unsigned int>; streamsize = long int]’:
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/basic_string.h:3900:30:   required from ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = unsigned int; _Traits = char_traits<unsigned int>; _Alloc = allocator<unsigned int>]’
../../../src/support/trivstring.cpp:257:12:   required from ‘std::basic_ostream<Char, std::char_traits<_CharT> >& lyx::operator<<(std::basic_ostream<Char, std::char_traits<_CharT> >&, const trivial_string<Char>&) [with Char = unsigned int]’
../../../src/support/trivstring.cpp:252:81:   required from here
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h:83:52: error: invalid use of incomplete type ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    83 |       typedef typename __ostream_type::ios_base    __ios_base;
       |                                                    ^~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/localefwd.h:41,
                  from /usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/string:43:
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/iosfwd:86:11: note: declaration of ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    86 |     class basic_ostream;
       |           ^~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h:85:39: error: invalid use of incomplete type ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    85 |       typename __ostream_type::sentry __cerb(__out);
       |                                       ^~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/iosfwd:86:11: note: declaration of ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    86 |     class basic_ostream;
       |           ^~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h:85:39: error: invalid use of incomplete type ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    85 |       typename __ostream_type::sentry __cerb(__out);
       |                                       ^~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/iosfwd:86:11: note: declaration of ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    86 |     class basic_ostream;
       |           ^~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h:90:44: error: invalid use of incomplete type ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    90 |               const streamsize __w = __out.width();
       |                                      ~~~~~~^~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/iosfwd:86:11: note: declaration of ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    86 |     class basic_ostream;
       |           ^~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h:93:47: error: invalid use of incomplete type ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    93 |                   const bool __left = ((__out.flags()
       |                                         ~~~~~~^~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/iosfwd:86:11: note: declaration of ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    86 |     class basic_ostream;
       |           ^~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h:98:29: error: invalid use of incomplete type ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    98 |                   if (__out.good())
       |                       ~~~~~~^~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/iosfwd:86:11: note: declaration of ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    86 |     class basic_ostream;
       |           ^~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h:100:39: error: invalid use of incomplete type ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
   100 |                   if (__left && __out.good())
       |                                 ~~~~~~^~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/iosfwd:86:11: note: declaration of ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    86 |     class basic_ostream;
       |           ^~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h:105:21: error: invalid use of incomplete type ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
   105 |               __out.width(0);
       |               ~~~~~~^~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/iosfwd:86:11: note: declaration of ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    86 |     class basic_ostream;
       |           ^~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h:109:21: error: invalid use of incomplete type ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
   109 |               __out._M_setstate(__ios_base::badbit);
       |               ~~~~~~^~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/iosfwd:86:11: note: declaration of ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    86 |     class basic_ostream;
       |           ^~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/bits/ostream_insert.h:113:21: error: invalid use of incomplete type ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
   113 |             { __out._M_setstate(__ios_base::badbit); }
       |               ~~~~~~^~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/iosfwd:86:11: note: declaration of ‘class std::basic_ostream<unsigned int, std::char_traits<unsigned int> >’
    86 |     class basic_ostream;
       |           ^~~~~~~~~~~~~
make[5]: *** [Makefile:948: trivstring.o] Error 1
make[5]: Leaving directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src/support'
make[4]: *** [Makefile:798: all] Error 2
make[4]: Leaving directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src/support'
make[3]: *** [Makefile:2397: all-recursive] Error 1
make[3]: Leaving directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src'
make[2]: *** [Makefile:1495: all] Error 2
make[2]: Leaving directory '/usr/local/src/lyx/lyx-devel/build-cygwin/src'
make[1]: *** [Makefile:568: all-recursive] Error 1
make[1]: Leaving directory '/usr/local/src/lyx/lyx-devel/build-cygwin'
make: *** [Makefile:462: all] Error 2


-- 
Enrico


More information about the lyx-devel mailing list