5417 build failed - Use of undeclared identifier m_ref_type

Questions, problems and discussion about compiling FreeOrion.

Moderators: Oberlus, Oberlus

Post Reply
Message
Author
Computer.Pers
Space Floater
Posts: 39
Joined: Wed Nov 07, 2012 7:14 am

5417 build failed - Use of undeclared identifier m_ref_type

#1 Post by Computer.Pers » Thu Nov 15, 2012 4:37 pm

OS X 10.8.2
Xcode 4.5
Revision 5417

file ValueRef.h:
Line 563: m_ref_type was notdeclared in ths scope
Line 564, 569 - Use of undeclared identifier 'm_ref_type'

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12689
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: 5417 build failed - Use of undeclared identifier m_ref_t

#2 Post by Geoff the Medio » Thu Nov 15, 2012 4:51 pm

mutable ReferenceType m_ref_type is declared in ValueRef::Variable<T> from which ValueRef::Statistic<T> is derived.

Try adding this-> before the instances of m_ref_type that are listed in the errors.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: 5417 build failed - Use of undeclared identifier m_ref_t

#3 Post by Dilvish » Thu Nov 15, 2012 4:55 pm

I also got build errors from that, until I changed the 3 offending citations from 'm_ref_type' to

Code: Select all

this->Variable<T>::m_ref_type
this->m_ref_type by itself does not do the job on my machine.
Last edited by Dilvish on Thu Nov 15, 2012 4:57 pm, edited 1 time in total.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: 5417 build failed - Use of undeclared identifier m_ref_t

#4 Post by Dilvish » Thu Nov 15, 2012 5:01 pm

well, I made the change after doing some quick reading on inheritance of protected members as opposed to public members; I can't recall seeing a specific rule that such would be necessary, but it was the impression I got, and it solved the problem.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12689
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: 5417 build failed - Use of undeclared identifier m_ref_t

#5 Post by Geoff the Medio » Thu Nov 15, 2012 5:05 pm

It's nothing to do with protected vs. public inheritance; it's a somewhat obscure issue with inheritance from a templated base class that the MSVC compiler seems to not handle according to the C++ standard.

Everything I've read says just this->m_ref_type should be sufficient to fix the problem, though, and that the explicit Variable<T> reference in that context could cause some problems in some cases, so could you double-check that?

Computer.Pers
Space Floater
Posts: 39
Joined: Wed Nov 07, 2012 7:14 am

Re: 5417 build failed - Use of undeclared identifier m_ref_t

#6 Post by Computer.Pers » Thu Nov 15, 2012 5:10 pm

Builded successful

Using both way.
Attachments
Снимок экрана 2012-11-15 в 21.09.44.png
Снимок экрана 2012-11-15 в 21.09.44.png (104.11 KiB) Viewed 846 times

User avatar
Vezzra
Release Manager, Design
Posts: 5346
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: 5417 build failed - Use of undeclared identifier m_ref_t

#7 Post by Vezzra » Thu Nov 15, 2012 9:22 pm

Computer.Pers wrote:OS X 10.8.2
Xcode 4.5
Revision 5417

file ValueRef.h:
Line 563: m_ref_type was notdeclared in ths scope
Line 564, 569 - Use of undeclared identifier 'm_ref_type'
I was going to post a bug report about this, but as I see, you guys have already sorted that one out. Perfect :D So I can put up the new test builds already (well, for OSX, Geoff has already put up the new test build for Win I noticed), I thought I'd had to postpone that due to this issue...

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: 5417 build failed - Use of undeclared identifier m_ref_t

#8 Post by Dilvish » Fri Nov 16, 2012 12:23 am

Geoff the Medio wrote:..so could you double-check that?
ya, as soon as I saw your suggestion, I double checked if the plain this->m_ref_type would work, but it got the same error as before popping up in my IDE (saying declaration not found).

Just to be extra thorough, I now tried to go ahead and build it anyway (which had failed with plain m_ref_type), and it did indeed build successfully using just this->m_ref_type (I guess the compiler is smarter than my IDE's semantic analysis plugin)
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Post Reply