Jump to content

T3D 3.7 conflict with sqlite.cpp


chriscalef

Recommended Posts

Hey,


I think I may have stumbled across a problem related to the console function / engine function changes... I haven't really paid adequate attention to that subject, but I was just trying to merge current trunk into my pre-3.7 build of OpenSimEarth, and came across this problem in SQLiteObject.cc (the old sqlite resource):

 

1>F:/T3D/Torque3D/Engine/source/console/console.h(885): error C2079: 'callback' uses undefined struct '_EngineConsoleExecCallbackHelper<P1>'
1>          with
1>          [
1>              P1=SQLiteObject *
1>          ]
1>          F:\T3D\Torque3D\Engine\source\console\SQLiteObject.cc(189) : see reference to function template instantiation 'ConsoleValueRef Con::executef<SQLiteObject*,const char*,const char*,char*>(A,B,C,D)' being compiled
1>          with
1>          [
1>              A=SQLiteObject *,
1>              B=const char *,
1>              C=const char *,
1>              D=char *
1>          ]
1>F:/T3D/Torque3D/Engine/source/console/console.h(885): error C2440: 'initializing' : cannot convert from 'SQLiteObject *' to 'int'
1>          There is no context in which this conversion is possible

 

The function causing the error is "Con::executef(this, ..." where this is the local SQLiteObject pointer:

 

bool SQLiteObject::OpenDatabase(const char* filename)
{  
  // check to see if we already have an open database, and
  // if so, close it.
  CloseDatabase();

 // We persist the error string so that the script may make a  
  // GetLastError() call at any time.  However when we get  
  // ready to make a call which could result in a new error,   
  // we need to clear what we have to avoid a memory leak.  
   ClearErrorString();  

  int isOpen = sqlite3_open(filename, &m_pDatabase);  
  if (isOpen == SQLITE_ERROR)  
  {  
     // there was an error and the database could not  
     // be opened.  
     m_szErrorString = (char *)sqlite3_errmsg(m_pDatabase);  
     Con::executef(this, "2", "onOpenFailed()", m_szErrorString);  //PROBLEM, cannot accept "this" SQLiteObject* as int
     return false;  
 }  
  else
  {
  //sqlite3_activate_cerod("!THIS$IS$NOT$YOUR$DATABASE!");
  //int res1=sqlite3_key(m_pDatabase,"ASD",1);
  //int res2=sqlite3_rekey(m_pDatabase,"ASD",1);
     // database was opened without error
     Con::executef(this, "1", "onOpened()");
  }
  return true;
}

 

Just wondering if anybody might have some insight on this issue before I get my shovel and start digging... :-P

Link to comment
Share on other sites

Whew, successful self-rescue! In case anyone stumbles across anything similar, the clue was the following comment in console.h:

 

00874: ///
00875: /// NOTE: if you get a rather cryptic template error coming through here, most likely you are trying to
00876: /// convert a parameter which EngineMarshallType does not have a specialization for.
00877: /// Another problem can occur if you do not include "console/simBase.h" and "console/engineAPI.h"
00878: /// since _EngineConsoleExecCallbackHelper and SimConsoleThreadExecCallback are required.

 

Turned out I was lacking "console/engineAPI.h", after adding it things went much better.

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...