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

gcc5: Fails to build #374

Closed
Ghabry opened this issue Jun 18, 2020 · 2 comments · Fixed by #375
Closed

gcc5: Fails to build #374

Ghabry opened this issue Jun 18, 2020 · 2 comments · Fixed by #375

Comments

@Ghabry
Copy link
Member

Ghabry commented Jun 18, 2020

[  9%] Building CXX object CMakeFiles/lcf.dir/src/reader_flags.cpp.o
In file included from /home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:10:0:
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp: In instantiation of 'void lcf::FlagsXmlHandler<S>::StartElement(lcf::XmlReader&, const char*, const char**) [with S = lcf::rpg::SavePicture::Flags]':
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:150:1:   required from here
/home/gabriel/scratch/Player/liblcf/src/reader_struct.h:670:12: error: 'static int lcf::Flags<S>::idx(const char*) [with S = lcf::rpg::SavePicture::Flags]' is private
 inline int Flags<S>::idx(const char* tag) {
            ^
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:118:33: error: within this context
   const auto idx = Flags<S>::idx(name);
                                 ^
In file included from /home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:10:0:
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp: In instantiation of 'void lcf::FlagsXmlHandler<S>::StartElement(lcf::XmlReader&, const char*, const char**) [with S = lcf::rpg::Terrain::Flags]':
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:150:1:   required from here
/home/gabriel/scratch/Player/liblcf/src/reader_struct.h:670:12: error: 'static int lcf::Flags<S>::idx(const char*) [with S = lcf::rpg::Terrain::Flags]' is private
 inline int Flags<S>::idx(const char* tag) {
            ^
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:118:33: error: within this context
   const auto idx = Flags<S>::idx(name);
                                 ^
In file included from /home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:10:0:
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp: In instantiation of 'void lcf::FlagsXmlHandler<S>::StartElement(lcf::XmlReader&, const char*, const char**) [with S = lcf::rpg::EventPageCondition::Flags]':
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:150:1:   required from here
/home/gabriel/scratch/Player/liblcf/src/reader_struct.h:670:12: error: 'static int lcf::Flags<S>::idx(const char*) [with S = lcf::rpg::EventPageCondition::Flags]' is private
 inline int Flags<S>::idx(const char* tag) {
            ^
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:118:33: error: within this context
   const auto idx = Flags<S>::idx(name);
                                 ^
In file included from /home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:10:0:
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp: In instantiation of 'void lcf::FlagsXmlHandler<S>::StartElement(lcf::XmlReader&, const char*, const char**) [with S = lcf::rpg::TroopPageCondition::Flags]':
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:150:1:   required from here
/home/gabriel/scratch/Player/liblcf/src/reader_struct.h:670:12: error: 'static int lcf::Flags<S>::idx(const char*) [with S = lcf::rpg::TroopPageCondition::Flags]' is private
 inline int Flags<S>::idx(const char* tag) {
            ^
/home/gabriel/scratch/Player/liblcf/src/reader_flags.cpp:118:33: error: within this context
   const auto idx = Flags<S>::idx(name);
                                 ^
make[2]: *** [CMakeFiles/lcf.dir/build.make:265: CMakeFiles/lcf.dir/src/reader_flags.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:158: CMakeFiles/lcf.dir/all] Error 2
make: *** [Makefile:150: all] Error 2
@Ghabry Ghabry added this to the 0.6.3 milestone Jun 18, 2020
@Ghabry
Copy link
Member Author

Ghabry commented Jun 18, 2020

Potential fix: Making "idx" public. (Friend declaration not working?)

diff --git a/src/reader_struct.h b/src/reader_struct.h
index c1a4037..0527b63 100644
--- a/src/reader_struct.h
+++ b/src/reader_struct.h
@@ -649,11 +649,12 @@ private:
 	static const std::array<bool, num_flags> flags_is2k3;
 
 	static const char* tag(int idx);
-	static int idx(const char* tag);
 
 	template <class T> friend class FlagsXmlHandler;
 
 public:
+	static int idx(const char* tag);
+
 	static void ReadLcf(S& obj, LcfReader& stream, uint32_t length);
 	static void WriteLcf(const S& obj, LcfWriter& stream);
 	static int LcfSize(const S& obj, LcfWriter& stream);

@fmatthew5876
Copy link
Contributor

I don't see why those methods should be private anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants