Game Development Community

Issue with _EngineTypeTraits

by Lukas Joergensen · in Torque 3D Professional · 01/02/2014 (4:12 pm) · 5 replies

I'm having an hard-to-track issue with the Taml system from T2D in T3D.

I get the following 8 errors:
Error	1	error C2838: 'SuperType' : illegal qualified name in member declaration	c:userslukasdocumentsgithubtorque3denginesourceconsoleenginetypes.h	122	1	Empty DLL
Error	2	error C2146: syntax error : missing ';' before identifier 'SuperType'	c:userslukasdocumentsgithubtorque3denginesourceconsoleenginetypes.h	122	1	Empty DLL
Error	3	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:userslukasdocumentsgithubtorque3denginesourceconsoleenginetypes.h	122	1	Empty DLL
Error	4	error C2602: '_EngineTypeTraits<T>::SuperType' is not a member of a base class of '_EngineTypeTraits<T>'	c:userslukasdocumentsgithubtorque3denginesourceconsoleenginetypes.h	122	1	Empty DLL
Error	5	error C2868: '_EngineTypeTraits<T>::SuperType' : illegal syntax for using-declaration; expected qualified-name	c:userslukasdocumentsgithubtorque3denginesourceconsoleenginetypes.h	122	1	Empty DLL
Error	6	error LNK1104: cannot open file 'C:UsersLukasDocumentsGitHubTorque3DMy ProjectsEmptygameEmpty_DEBUG.lib'	C:UsersLukasDocumentsGitHubTorque3DMy ProjectsEmptybuildFilesVisualStudio 2012projectsLINK	IE Empty Plugin
Error	7	error LNK1104: cannot open file 'C:UsersLukasDocumentsGitHubTorque3DMy ProjectsEmptygameEmpty_DEBUG.lib'	C:UsersLukasDocumentsGitHubTorque3DMy ProjectsEmptybuildFilesVisualStudio 2012projectsLINK	Empty
Error	8	error LNK1104: cannot open file 'C:UsersLukasDocumentsGitHubTorque3DMy ProjectsEmptygameEmpty_DEBUG.lib'	C:UsersLukasDocumentsGitHubTorque3DMy ProjectsEmptybuildFilesVisualStudio 2012projectsLINK	NP Empty Plugin

I'm completely lost on this, all I know is that the code causing the issue, is probably related to some of these Defines like:
#define DECLARE_CLASS( type, super )                                                   
   public:                                                                             
      typedef type ThisType;                                                           
      typedef super SuperType;                                                         
      template< typename T > friend struct ::_EngineTypeTraits;                        
      template< typename T > friend struct ::_SCOPE;                                   
      template< typename T > friend T* _CREATE();                                      
      template< typename T, typename Base > friend class ::EngineClassTypeInfo;        
   private:                                                                            
      typedef ::_Private::_ConcreteClassBase< ThisType > _ClassBase;                   
      static EngineClassTypeInfo< ThisType, _ClassBase > _smTypeInfo;                  
      static EngineExportScope& __engineExportScope();                                 
      static EnginePropertyTable& _smPropertyTable;                                    
      virtual const EngineTypeInfo* __typeinfo() const;                                
   public:

All the code are available on my online repo:
https://github.com/lukaspj/Torque3D/tree/TAMLImplementation

The Taml directory is in source/taml

#1
01/03/2014 (5:05 am)
Are you sure you defined an EngineTypeTraits for the type its trying to process? Usually this is done by the DECLARE_* defines.
#2
01/03/2014 (5:10 am)
If only I knew what type it is thats causing the issue. I've made numerous changes to the code.. My best bet is that it is the Taml class, but it has it defined like this:
DECLARE_CONOBJECT( Taml );
I'll try look for IMPLEMENT that has no associated DECLARE
#3
01/03/2014 (5:27 am)
Okay, I tracked the issue to my changes in taml_ScriptBinding.h

Basically, it doesn't like when Taml::TamlFormatMode is used in that file like this:
DefineEngineMethod(Taml, setFormat, void, (Taml::TamlFormatMode formatMode), ,  "(format) - Sets the format that Taml should use to read/write.\n"
                                            "@param format The format to use: 'xml' or 'binary'.\n"
                                            "@return No return value.")
{
      // Was the format valid?
      if ( formatMode == Taml::InvalidFormat )
      {
         // No, so warn.
         Con::warnf( "Taml::setFormat() - Invalid format mode used: '%s'.", formatMode );
         return;
      }

      // Set format mode.
      object->setFormatMode( formatMode );
}

TamlFormatMode is implemented like this:
typedef Taml::TamlFormatMode _TamlFormatMode;
ImplementEnumType( _TamlFormatMode,
   "")
   { Taml::XmlFormat, "xml" },
   { Taml::BinaryFormat, "binary" }
EndImplementEnumType;

And doing this:
addField("Format", TYPEID<_TamlFormatMode>(), Offset(mFormatMode, Taml), "The read/write format that should be used.");
In the same file as the implementation, brings no issues.
#4
01/03/2014 (1:43 pm)
Hi Lukas, from looking at your code - are you porting over the T2D master branch version of TAML? The development branch has some changes and additions like JSON format support, in case it is of interest to you.
#5
01/03/2014 (1:54 pm)
@Mike that sounds great! I will look at updating the Taml code then! JSON support was one of the things I needed.