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

Missing include files #179

Open
stoecker opened this issue Oct 27, 2021 · 5 comments
Open

Missing include files #179

stoecker opened this issue Oct 27, 2021 · 5 comments

Comments

@stoecker
Copy link

To build with openSUSE_Tumbleweed following patch is necessary:

diff -ur Wyrmgus-5.2.3/src/util/assert_util.h Wyrmgus-5.2.3_fix/src/util/assert_util.h
--- Wyrmgus-5.2.3/src/util/assert_util.h        2021-10-20 08:29:11.000000000 +0200
+++ Wyrmgus-5.2.3_fix/src/util/assert_util.h    2021-10-27 17:00:26.491432595 +0200
@@ -26,6 +26,9 @@
 
 #pragma once
 
+#include <source_location>
+#include <string>
+
 namespace wyrmgus {
 
 inline std::string get_source_relative_filepath_string(const std::string &filepath)

The first of these two probably needs to be surrounded with the same #ifdefs as later in the file.

@Andrettin
Copy link
Owner

Thanks for the info! Do you know in which .cpp file the compilation fails?

Those headers should already be included indirectly through the stratagus.h header, which should be included in every .cpp file (but it is missing in one of them).

@stoecker
Copy link
Author

As far as I remember the first error I've seen was in assert_util.cpp.

@Andrettin
Copy link
Owner

Sorry for the delay in responding.

It is strange that the error is present in assert_util.cpp, since that includes stratagus.h, which in turn includes pch.h, which then includes and <source_location>. I'm not sure what could be causing this issue, especially since the automatic compilation workflow is working without any problems.

@susnux
Copy link
Contributor

susnux commented Dec 6, 2021

Thanks for the info! Do you know in which .cpp file the compilation fails?

The error message:

[ 78s] In file included from /home/abuild/rpmbuild/BUILD/Wyrmgus-5.2.4/src/util/assert_util.cpp:29,
[ 78s] from /home/abuild/rpmbuild/BUILD/Wyrmgus-5.2.4/build/CMakeFiles/wyrmgus.dir/Unity/unity_util_cxx.cxx:5:
[ 78s] /home/abuild/rpmbuild/BUILD/Wyrmgus-5.2.4/src/util/assert_util.h:43:50: error: 'source_location' in namespace 'std' does not name a type
[ 78s] 43 | inline std::string get_assert_message(const std::source_location &location)
[ 78s] | ^~~~~~~~~~~~~~~
[ 78s] /home/abuild/rpmbuild/BUILD/Wyrmgus-5.2.4/src/util/assert_util.h:1:1: note: 'std::source_location' is defined in header '<source_location>'; did you forget to '#include <source_location>'?
[ 78s] +++ |+#include <source_location>

Full log:
build-log.txt

@Andrettin
Copy link
Owner

I think I understand the reason for the issue now. I had made a mistake in the pch.h file, only including <source_location> if __cpp_lib_source_location were defined. But the latter is defined either in <source_location> itself, or in .

So whether this worked was compiler-dependent, if the C++ standard library headers for that implementation included directly or indirectly before we got to the <source_location> check.

I've fixed this issue now by replacing that condition with a check to __has_include<source_location> (in my two latest commits).

I hope this works!

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

3 participants