Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cursor.h:137 error: field ‘Ident’ has incomplete type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} #688

Closed
egberts opened this issue Jun 1, 2024 · 1 comment

Comments

@egberts
Copy link

egberts commented Jun 1, 2024

On Debian 12, pulling the latest main branch (3941a355), cmake, then make, I get the following error:

src/include/cursor.h:137:21: error: field ‘Ident’ has incomplete type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}
  137 |         std::string Ident;  /// Identifier to reference it
      |                     ^~~~~

To recreate this on an unpatched Debian 12 using gcc 12.2.0 toolchain:

$ git clone --recurse-submodules https://github.com/Wargus/strratagum
$ cd stratagum
$ mkdir build
$ cmake ..
$ VERBOSE=defined make

<snipped out the largely successful error-free, warning-free compilation ...>

make[2]: Entering directory '/home/user/admin/games/stratagus/build'
cd /home/user/admin/games/stratagus/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/user/admin/games/stratagus /home/user/admin/games/stratagus /home/user/admin/games/stratagus/build /home/user/admin/games/stratagus/build /home/user/admin/games/stratagus/build/CMakeFiles/stratagus_lib.dir/DependInfo.cmake --color=
Dependencies file "CMakeFiles/stratagus_lib.dir/src/ui/mouse.cpp.o.d" is newer than depends file "/home/user/admin/games/stratagus/build/CMakeFiles/stratagus_lib.dir/compiler_depend.internal".
Consolidate compiler generated dependencies of target stratagus_lib
make[2]: Leaving directory '/home/user/admin/games/stratagus/build'
make  -f CMakeFiles/stratagus_lib.dir/build.make CMakeFiles/stratagus_lib.dir/build
make[2]: Entering directory '/home/user/admin/games/stratagus/build'
[ 19%] Building CXX object CMakeFiles/stratagus_lib.dir/src/ui/mouse.cpp.o

/usr/bin/c++ -DDYNAMIC_LOAD -DHAVE_GETOPT -DHAVE_STRNLEN -DPIXMAPS=\"/usr/local/share/pixmaps\" -DUSE_BZ2LIB -DUSE_LINUX -DUSE_OPENMP -DUSE_VORBIS -DUSE_ZLIB -I/home/user/admin/games/stratagus/src/include -I/home/user/admin/games/stratagus/src/third_party -I/home/user/admin/games/stratagus/build -I/home/user/admin/games/stratagus/third-party/mdns -I/home/user/admin/games/stratagus/third-party/spiritless_po/include -isystem /usr/include/lua5.1 -isystem /usr/include/SDL2 -isystem /home/user/admin/games/stratagus/third-party/guichan/include -g -ggdb -fsigned-char -fPIC -fopenmp -std=gnu++17 -MD -MT CMakeFiles/stratagus_lib.dir/src/ui/mouse.cpp.o -MF CMakeFiles/stratagus_lib.dir/src/ui/mouse.cpp.o.d -o CMakeFiles/stratagus_lib.dir/src/ui/mouse.cpp.o -c /home/user/admin/games/stratagus/src/ui/mouse.cpp
In file included from /home/user/admin/games/stratagus/src/ui/mouse.cpp:43:
/home/user/admin/games/stratagus/src/include/cursor.h:137:21: error: field ‘Ident’ has incomplete type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}
  137 |         std::string Ident;  /// Identifier to reference it
      |                     ^~~~~
In file included from /usr/include/c++/12/iosfwd:39,
                 from /usr/include/c++/12/bits/shared_ptr.h:52,
                 from /usr/include/c++/12/memory:77,
                 from /home/user/admin/games/stratagus/src/include/actions.h:38,
                 from /home/user/admin/games/stratagus/src/include/action/action_build.h:33,
                 from /home/user/admin/games/stratagus/src/ui/mouse.cpp:39:
/usr/include/c++/12/bits/stringfwd.h:72:11: note: declaration of ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’}
   72 |     class basic_string;
      |           ^~~~~~~~~~~~

Me think that gcc 12.2 finally kicked out the C11 and (some C17) compliance part in 100% full-force

@egberts
Copy link
Author

egberts commented Jun 1, 2024

A simple adding the string.h include file into cursor.h appears to fix the compilation problem of this source file mouse.cpp

New code snippet of cursor.h:

/*----------------------------------------------------------------------------
--  Includes
----------------------------------------------------------------------------*/

#include <string>  // new line

#include "sdl2_helper.h"
#include "vec2i.h"

#include <SDL.h>
#include <vector>

egberts pushed a commit to egberts/stratagus that referenced this issue Jun 1, 2024
@egberts egberts closed this as completed Jun 2, 2024
Jarod42 pushed a commit that referenced this issue Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant