Menu

#122 wxSqlite3 minimal sample link problem

closed-rejected
None
5
2010-07-12
2010-07-11
No

Hi,

I have link problem with wxsqlite3-1.9.9 minimal example program.
"Static Unicode Debug Monolithic Static" configuration compiles but
At VC++ 2008
"Static Unicode Release Monolithic Static" configuration gaves these link problems:

minimal.obj : error LNK2001: unresolved external symbol "private: static int wxDebugContextDumpDelayCounter::sm_count" (?sm_count@wxDebugContextDumpDelayCounter@@0HA)
wxcode_msw28u_wxsqlite3.lib(wxsqlite3.obj) : error LNK2001: unresolved external symbol "private: static int wxDebugContextDumpDelayCounter::sm_count" (?sm_count@wxDebugContextDumpDelayCounter@@0HA)
minimal.obj : error LNK2001: unresolved external symbol "private: void __thiscall wxDebugContextDumpDelayCounter::DoDump(void)" (?DoDump@wxDebugContextDumpDelayCounter@@AAEXXZ)
wxcode_msw28u_wxsqlite3.lib(wxsqlite3.obj) : error LNK2001: unresolved external symbol "private: void __thiscall wxDebugContextDumpDelayCounter::DoDump(void)" (?DoDump@wxDebugContextDumpDelayCounter@@AAEXXZ)
..\samples\minimal.exe : fatal error LNK1120: 2 unresolved externals

Discussion

  • Ulrich Telle

    Ulrich Telle - 2010-07-11
    • assigned_to: nobody --> utelle
     
  • Ulrich Telle

    Ulrich Telle - 2010-07-11

    From inspecting the wxSQLite3 VC++ 2008 project files I don't see any reason why you get those linker errors. As far as I see the correct libraries are referenced, There is no direct reference to the missing wxWidgets debug class wxDebugContextDumpDelayCounter in wxSQLite3.

    A reference to the missing symbol can only be generated from the wxWidgets header file memory.h (which is included indirectly). The condition is as follows:

    #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT

    In a release build __WXDEBUG__ is not defined. So you should check whether wxUSE_DEBUG_CONTEXT is set to 1 in your wxWidgets setup.h file.

    I don't think this is a wxSQLite3 issue. Maybe you have conflicting wxWidgets configurations on your system. Unfortunately I don't have experience with the monolithic build of wxWidgets, so I can't give further hints.

     
  • Anonymous

    Anonymous - 2010-07-11

    I have changed the wxUSE_DEBUG_CONTEXT to 1 for debugging purpose to catch memory leaks.

    Are there any solution to this without recompiling the wxWidgets library? (for example undef any define at minimal application level)

     
  • Ulrich Telle

    Ulrich Telle - 2010-07-12

    So in fact this isn't a wxSQLite3 issue.

    After changing settings in setup.h you have to recompile the wxWidgets library.

    Memory leak detection should be done based on the debug build. To get better diagnostics from VC++ you might consider to use the header file I use in my other component wxPdfDocument to detect memory leaks instead of:wxUSE_DEBUG_CONTEXT:

    http://wxcode.svn.sourceforge.net/viewvc/wxcode/trunk/wxCode/components/wxpdfdoc/src/wxmemdbg.h?revision=1026&view=markup

    If you include this header in your own C++ class source files, compile in debug mode and your application has memory leaks VC++ emits on program termination a list of still allocated memory blocks including a message where these blocks were allocated.

     
  • Ulrich Telle

    Ulrich Telle - 2010-07-12
    • status: open --> closed-rejected
     
  • Nobody/Anonymous

    Thanks.

    At minimal example there is a wrong lib setting at "wxmsw28ud.lib" There is not a "wxmsw28ud.lib" library at VC++ with wxWidgets . I change this library name with "wxbase28ud.lib"

    Mustafa

     
  • Ulrich Telle

    Ulrich Telle - 2010-07-12

    For the monolithic build of wxWidgets the library name is

    wx<port><release><unicodeflag><debugflag>.lib

    i.e. for VC++ on Windows wxmsw28ud.lib

    To my knowledge wxbase28ud.lib is the base library in a multilib build of wxWidgets.

    It should definitely not be necessary to change the wxSQLite3 project files if wxWidgets itself was built correctly.

     
  • Anonymous

    Anonymous - 2010-07-12

    Sorry I didn't realized Monolithic and multilib at one moment.

    Last question :)

    I have linked with static library of sqlite instead of dynamic one "sqlite3.lib" Because with dynamic one(dll) programs need sqlite.dll. At this address: (http://news.thedigitalmachine.com/2007/03/28/set-up-sqlite-static-lib-and-a-c-wrapper-in-15-minutes/ ) Does this make any problem?

    Regards

     
  • Ulrich Telle

    Ulrich Telle - 2010-07-12

    There is no problem at all to use a statically linked SQLite library together with wxSQLite3. But I would recommend to use the SQLite amalgamation source for building your own version of the SQLite library.

    The following link gives you some details about the preprocessor defines which could/should be used when compiling SQLite:

    http://wxforum.shadonet.com/viewtopic.php?t=27217

     

Log in to post a comment.