Fixed compilation error
Fixed "include/record3d/Record3DStructs.h:33:21: error: field ‘udid’ has incomplete type 'std::string'"
Just to add some context for this pr:
I was able to reproduce this build failure on a clean system:
- OS: Ubuntu 24.04 LTS (x86_64)
- Compiler: GCC 13.3.0
- CMake: 3.28.3
- Python: 3.11.0
The error looks like this:
include/record3d/Record3DStructs.h:33:21: error: field ‘udid’ has incomplete type ‘std::string’
33 | std::string udid{ "" };
| ^~~~
/usr/include/c++/13/bits/stringfwd.h:72:11: note: declaration of ‘std::string’
72 | class basic_string;
| ^~~~~~~~~~~~
This happens because Record3DStructs.h uses std::string but doesn’t explicitly include <string>.
On older GCC/libstdc++ versions (e.g. GCC 9/10), this compiled fine because <string> was indirectly included by other headers.
However, starting with GCC 13, libstdc++ intentionally reduced accidental header inclusions. From the [Porting to GCC 13 guide:
Some C++ Standard Library headers have been changed to no longer include other headers that were being used internally by the library. As such, C++ programs that used standard library components without including the right headers will no longer compile.
The following headers are used less widely in libstdc++ and may need to be included explicitly when compiling with GCC 13:
<string>(forstd::string,std::to_string,std::stoi, etc.)<system_error>(forstd::error_code,std::system_error, etc.)<cstdint>,<cstdio>,<cstdlib>
So this PR is the correct fix: explicitly including <string> makes the header self‑contained and portable across compilers.
I tested the patch locally and can confirm it resolves the build error on GCC 13.
Hi, I was wondering why this was removed from recent updates to main?