PDA

View Full Version : WxWindows e ODBC


miondere
30-03-2004, 17:12
Qualcuno di voi usa le wxWindows?

Devo realizzare un piccolo programma che attraverso le wx mi permetta di accedere ad un database tramite odbc (usando visual studio 6.0).
Ho incluso le wx.h come vedete sotto.


//------------------------

#include <wx/wxprec.h>

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP

// Include your minimal set of headers here, or wx.h
#include <wx/wx.h>

#endif

#include <wx/db.h>



//----------------------


Poi devo stabilire la connessione con il database (ne ho creato uno in access di nome "db1") e ho creato un dsn utente di nome "database1" che fa riferimento al database creato.
Per stabilire la connessione scrivo il seguente codice:

//---------------


int main()
{
wxDbConnectInf DbConnectInf;
DbConnectInf.SetDsn("database1");
DbConnectInf.SetUserID("tommi");
DbConnectInf.SetPassword("tommi");
DbConnectInf.SetDefaultDir("d:/Università/mi distribuiti/db1.mdb");

return 0;
}

//--------------

In fase di linking mi da i seguenti errori, sapete come risolverli? Sbaglio in qualche punto? Devo inserire qualche libreria particolare? :( Grazie e ciao!


data.obj : error LNK2001: unresolved external symbol "public: __thiscall wxDbConnectInf::~wxDbConnectInf(void)" (??1wxDbConnectInf@@QAE@XZ)
data.obj : error LNK2001: unresolved external symbol "public: void __thiscall wxDbConnectInf::SetPassword(class wxString const &)" (?SetPassword@wxDbConnectInf@@QAEXABVwxString@@@Z)
data.obj : error LNK2001: unresolved external symbol "public: void __thiscall wxDbConnectInf::SetUserID(class wxString const &)" (?SetUserID@wxDbConnectInf@@QAEXABVwxString@@@Z)
data.obj : error LNK2001: unresolved external symbol "public: void __thiscall wxDbConnectInf::SetDsn(class wxString const &)" (?SetDsn@wxDbConnectInf@@QAEXABVwxString@@@Z)
data.obj : error LNK2001: unresolved external symbol "public: __thiscall wxDbConnectInf::wxDbConnectInf(void)" (??0wxDbConnectInf@@QAE@XZ)
data.obj : error LNK2001: unresolved external symbol "public: class wxString & __thiscall wxString::operator=(class wxString const &)" (??4wxString@@QAEAAV0@ABV0@@Z)
data.obj : error LNK2001: unresolved external symbol "private: void __thiscall wxString::InitWith(char const *,unsigned int,unsigned int)" (?InitWith@wxString@@AAEXPBDII@Z)
Debug/data.exe : fatal error LNK1120: 7 unresolved externals




Qualcuno di voi usa le wxWindows? :muro:

cionci
31-03-2004, 01:29
Devi linkare la libreria wxmsw.lib al tuo progetto...

miondere
31-03-2004, 16:02
Originariamente inviato da cionci
Devi linkare la libreria wxmsw.lib al tuo progetto...


Intendi le "wxmswd.lib"? Perchè le wxmsw.lib non riesco a trovarle...
Comunque mettendo le wxmswd.lib mi da vari altri errori tipo questi ma anche altri:

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _malloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _realloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _free already defined in LIBCD.lib(dbgheap.obj)



Poi quando inclusi le wx.h non mi trovava setup.h che ho copiato dalla cartella "msw" e messo nella cartella principale, è corretto?
Il file setup.h va scelto in base al sistema operativo che usiamo, no?
Ho settato inoltre in setup.h

#define wxUSE_ODBC 1

(era a 0)

miondere
04-04-2004, 10:46
Qualcuno ha un piccolo script che accede semplicemente ad un database tramite usando le Wxwindows?

grazie,ciao :-)