wxsqlite3 in eigenes Projekt einfügen Topic is solved

In this forum you can discuss database related issues which can be wxWidgets related, but also generic in nature.
Post Reply
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

wxsqlite3 in eigenes Projekt einfügen

Post by Wolfgang »

Hallo

Kann mir bitte jemand helfen.

Ich versuche bereits seit Stunden wxsqlite3 in mein eigenes Projekt einzufügen.
Fange gerade erst mit Visual Studio 2015 und C++ an,(früher VB und Java mit Android Studio) also hier wäre eine Step-by-Srep Erklräung ganz gut.

Habe in meinen include/wx habe ich bereits wxsqlite.cpp und den include/wx folder hineinkopiert.
in include habe ich von secure../include hineinkopiert

In meinem Projekt habe ich
#include "wxsqlite3.h"

Im Solution explorer habe ich
wxsqlite3.h
wxsqlite3_version.h
wxsqlitedef.h
included in projekt, Ful Path zeigt auf die Datei

in meinem Source file.

wxSQLite3Database h_db;

h_db.Open(wxS("bibel.db"));

Beim Compilieren folgende Fehler

3> hadeverim.cpp
3>hadeverim.obj : error LNK2019: unresolved external symbol "public: __cdecl wxSQLite3Database::wxSQLite3Database(void)" (??0wxSQLite3Database@@QEAA@XZ) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
3>hadeverim.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl wxSQLite3Database::~wxSQLite3Database(void)" (??1wxSQLite3Database@@UEAA@XZ) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
3>hadeverim.obj : error LNK2019: unresolved external symbol "public: void __cdecl wxSQLite3Database::Open(class wxString const &,class wxString const &,int)" (?Open@wxSQLite3Database@@QEAAXAEBVwxString@@0H@Z) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
3>vc_x64_mswud\hadeverim.exe : fatal error LNK1120: 3 unresolved externals

Danke
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxsqlite3 in eigenes Projekt einfügen

Post by ONEEYEMAN »

Hi,
This is an English-speaking forum.
Please try to translate your message and repost.

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxsqlite3 in eigenes Projekt einfügen

Post by doublemax »

Habe in meinen include/wx habe ich bereits wxsqlite.cpp und den include/wx folder hineinkopiert.
in include habe ich von secure../include hineinkopiert
Keine gute Idee. Kopiere alle wxSQLite3 Dateien in das Verzeichnis von deinem Projekt, so als wären es deine eigenen. Einschließlich der wxsqlite3.cpp und sqlite3.c

Diese musst du auch deinem Projekt hinzufügen, damit sie kompiliert werden.

sqlite.c ist Teil von sqlite-amalgamation und das bekommst du hier:
https://www.sqlite.org/download.html
Use the source, Luke!
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxsqlite3 in eigenes Projekt einfügen

Post by utelle »

Hallo Wolfgang,

in der ersten Antwort auf Deine Anfrage hat ONEEYEMAN zu recht daruf hingewiesen, dass es sich hier um ein Englisch-sprachiges Forum handelt. In Zukunft bitte auf Englisch schreiben, wenn Du hier Antworten bekommen möchtest.

Im folgenden ein paar Anmerkungen - ausnahmsweise auf Deutsch.
Wolfgang wrote:Ich versuche bereits seit Stunden wxsqlite3 in mein eigenes Projekt einzufügen.
Fange gerade erst mit Visual Studio 2015 und C++ an,(früher VB und Java mit Android Studio) also hier wäre eine Step-by-Srep Erklräung ganz gut.
wxSQLite3 bringt insbesondere für diverse Visual C++ Versionen Projektdateien (*.sln, *.vcxproj) mit - auch für VC++ 2015 (wxsqlite3_vc14.sln).

Die Projektdateien enthalten mehrere Konfigurationen, so dass es relativ leicht sein sollte, die zum eigenen Projekt passende Konfiguration zu wählen.
Wolfgang wrote: Habe in meinen include/wx habe ich bereits wxsqlite.cpp und den include/wx folder hineinkopiert.
in include habe ich von secure../include hineinkopiert
Insbesondere für jemanden mit wenig Erfahrung im Umgang mit Visual Studio ist das keine wirklich gute Idee wie auch schon doublemax angemerkt hat.

wxSQLite3 bringt - außer der wxWidgets-Bibliothek - alles mit, was man benötigt. Ein separates Herunterladen des SQLite-Quellcodes ist also nicht erforderlich.

Am besten ist es, die in wxSQLite3 vorhandenen Projektdateien zu verwenden, um entweder eine statische wxSQLite3-Bibliothek (lib) oder eine wxSQLite3-DLL zu erzeugen, auf die man dann im eigenen Projekt verweist.

Natürlich kann man die wxSQLite3-Quelldateien auch dem eigenen Projekt hinzufügen, aber dann muss man eben darauf achten, dass wirklich alle erforderlichen Dateien dabei sind. Außerdem erfordert das Kompilieren eine Reihe korrekt definierter Präprozessor-Symbole.

Anhand der Visual C++ Projektdateien kannst Du die benötigten Dateien und Symbole herausfinden.

Ein erster Test wäre, die mit wxSQLite3 kommenden Beispielprogramme zu kompilieren und laufen zu lassen.
Wolfgang wrote:Beim Compilieren folgende Fehler

3> hadeverim.cpp
3>hadeverim.obj : error LNK2019: unresolved external symbol "public: __cdecl wxSQLite3Database::wxSQLite3Database(void)" (??0wxSQLite3Database@@QEAA@XZ) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
3>hadeverim.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl wxSQLite3Database::~wxSQLite3Database(void)" (??1wxSQLite3Database@@UEAA@XZ) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
3>hadeverim.obj : error LNK2019: unresolved external symbol "public: void __cdecl wxSQLite3Database::Open(class wxString const &,class wxString const &,int)" (?Open@wxSQLite3Database@@QEAAXAEBVwxString@@0H@Z) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
3>vc_x64_mswud\hadeverim.exe : fatal error LNK1120: 3 unresolved externals
Das sieht nach einer fehlerhaften Projektkonfiguration aus, was u.U. an einer fehlerhaften Definition des Symbols WXDLLIMPEXP_SQLITE3 liegen könnte.

Viele Grüße,

Ulrich
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxsqlite3 in eigenes Projekt einfügen

Post by ONEEYEMAN »

Thx, Ulrich.
2Wolfgang:
While I'm sure you got some good advise from doublemax and Ulrich (who is wxSQLite maintainer), you would've get more replies from other people, and much faster, who does not read/write/understand German/Austrian/Swiss/etc dialect that is mother one for you.

So in the future, try to translate you problem in English and post here.

Thank you.
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: wxsqlite3 in eigenes Projekt einfügen

Post by Wolfgang »

Sorry guys.

I read and write english almost like it would be german. So for me it does not really make a big difference. But I'm still from the older generation and we learn by doing. So that's why I wanted to include it into my solution folder and I wrote in german as I did know utelle is from Germany, and I hoped to get an answer from him, Tend to go to the creator.

Did remember now, that I did manage to compile the samples, but for that I had to copy the wxsqlite.h files to the include/wx of the wxwidgets folder.

So that said, I guess, I should start with the samples again.
Last edited by Wolfgang on Tue Jan 29, 2019 7:45 am, edited 1 time in total.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxsqlite3 in eigenes Projekt einfügen

Post by ONEEYEMAN »

Hi, Wolfgang,
I understand you wanted to talk to the source, but Ulrich, also can read/write/understand English. ;-)

Besides, as I said earlier, there are some guys that possibly went thru the same issues you have right now and fixed it, but they were not able to help because they were not able to read and/or write German.

Besides, in order to be polite you forced the replies to be in German and now we (non-German speakers) can only guess whether the issue you have will be solved or not. and whether to continue monitoring this thread or not.

Thank you.
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: wxsqlite3 in eigenes Projekt einfügen

Post by Wolfgang »

Ok, what I now tried.

Extracted the sqlite3-master again, did not eliminate the first folder, so that the folder structure is /3party/sqlit../sqlit../(here the folders)

Then compiling worked out of the box.

Then I just included an existing project to my solution, and still it does not work.

Meanwhile I also tried to copy all relevant files to the folder where my files are. And same result it did not work.

So If I compile only with the include file no wxsqLite3 command.
In the project additional include directories I hardcoded the folder where wxsqlite3.h is in.

Code: Select all

#include "wxsqlite3.h"
#include "wx/filefn.h"
#include <ctime>
#include <iostream>
#include "wx/string.h"

Then it compiles right.

If I use:

Code: Select all

	wxSQLite3Database h_db;
	h_db.Open(wxS("d:/hdevarim/init/bibel.db"));
	h_db.Close()


I get this error messages:

Code: Select all

1>hadeverim.obj : error LNK2019: unresolved external symbol "public: __cdecl wxSQLite3Database::wxSQLite3Database(void)" (??0wxSQLite3Database@@QEAA@XZ) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
1>hadeverim.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl wxSQLite3Database::~wxSQLite3Database(void)" (??1wxSQLite3Database@@UEAA@XZ) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
1>hadeverim.obj : error LNK2019: unresolved external symbol "public: void __cdecl wxSQLite3Database::Open(class wxString const &,class wxString const &,int)" (?Open@wxSQLite3Database@@QEAAXAEBVwxString@@0H@Z) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
1>hadeverim.obj : error LNK2019: unresolved external symbol "public: void __cdecl wxSQLite3Database::Close(void)" (?Close@wxSQLite3Database@@QEAAXXZ) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
1>vc_x64_mswud\hadeverim.exe : fatal error LNK1120: 4 unresolved externals


If I use:

Code: Select all

	wxSQLite3Database* h_db = new wxSQLite3Database();
	h_db->Open(wxS("d:/hdevarim/init/bibel.db"));
	h_db->Close();
I get this error messages;

Code: Select all

1>hadeverim.obj : error LNK2019: unresolved external symbol "public: __cdecl wxSQLite3Database::wxSQLite3Database(void)" (??0wxSQLite3Database@@QEAA@XZ) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
1>hadeverim.obj : error LNK2019: unresolved external symbol "public: void __cdecl wxSQLite3Database::Open(class wxString const &,class wxString const &,int)" (?Open@wxSQLite3Database@@QEAAXAEBVwxString@@0H@Z) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
1>hadeverim.obj : error LNK2019: unresolved external symbol "public: void __cdecl wxSQLite3Database::Close(void)" (?Close@wxSQLite3Database@@QEAAXXZ) referenced in function "public: virtual bool __cdecl MyApp::OnInit(void)" (?OnInit@MyApp@@UEAA_NXZ)
1>vc_x64_mswud\hadeverim.exe : fatal error LNK1120: 3 unresolved externals
So perhaps this can help now.
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: wxsqlite3 in eigenes Projekt einfügen

Post by Wolfgang »

Additional info:

The sqlite3secure was not able to compile without errors:

Code: Select all

Severity	Code	Description	Project	File	Line	Suppression State
Error	C1083	Cannot open include file: 'unicode/utypes.h': No such file or directory	sqlite3libicu	d:\wxwidgets-3.1.2\1own\hadevarim\wxsqlite3-master\sqlite3secure\src\sqlite3.c	185390	
Error	C1083	Cannot open include file: 'unicode/utypes.h': No such file or directory	sqlite3dllicu	d:\wxwidgets-3.1.2\1own\hadevarim\wxsqlite3-master\sqlite3secure\src\sqlite3.c	185390	
Error	LNK1104	cannot open file 'icuind.lib'	sqlite3shellicu	D:\wxWidgets-3.1.2\1own\hadevarim\wxsqlite3-master\sqlite3secure\build\LINK	1	
Kvaz1r
Super wx Problem Solver
Super wx Problem Solver
Posts: 357
Joined: Tue Jun 07, 2016 1:07 pm

Re: wxsqlite3 in eigenes Projekt einfügen

Post by Kvaz1r »

Wolfgang wrote: Did remember now, that I did manage to compile the samples, but for that I had to copy the wxsqlite.h files to the include/wx of the wxwidgets folder.
Why do you need move or copy the files anywhere?

Build sample and if it compiles and runs correctly look as included library files and do same in your project like you already did for wxWidgets itself.
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxsqlite3 in eigenes Projekt einfügen

Post by doublemax »

When wxSQLite3Database is missing at link time, you either didn't add wxsqlite3.cpp to your project or didn't link the wxsqlite3 library (which ever method you chose to use).
Use the source, Luke!
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxsqlite3 in eigenes Projekt einfügen

Post by utelle »

Hi Wolfgang,
Wolfgang wrote:... and I wrote in german as I did know utelle is from Germany, and I hoped to get an answer from him, Tend to go to the creator.
Yes, I'm from Germany, but I use English almost every day. And usually I'm quite responsive, although I don't check the wxForum daily.
Wolfgang wrote:Did remember now, that I did manage to compile the samples, but for that I had to copy the wxsqlite.h files to the include/wx of the wxwidgets folder.
This should never be necessary. To avoid it you may have to add an include search path for the preprocessor in your project's solution/project file.

Regards,

Ulrich
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxsqlite3 in eigenes Projekt einfügen

Post by utelle »

Wolfgang wrote:Additional info:

The sqlite3secure was not able to compile without errors:

Code: Select all

Severity	Code	Description	Project	File	Line	Suppression State
Error	C1083	Cannot open include file: 'unicode/utypes.h': No such file or directory	sqlite3libicu	d:\wxwidgets-3.1.2\1own\hadevarim\wxsqlite3-master\sqlite3secure\src\sqlite3.c	185390	
Error	C1083	Cannot open include file: 'unicode/utypes.h': No such file or directory	sqlite3dllicu	d:\wxwidgets-3.1.2\1own\hadevarim\wxsqlite3-master\sqlite3secure\src\sqlite3.c	185390	
Error	LNK1104	cannot open file 'icuind.lib'	sqlite3shellicu	D:\wxWidgets-3.1.2\1own\hadevarim\wxsqlite3-master\sqlite3secure\build\LINK	1	
It is unclear what you are trying to accomplish.

wxSQLite3 includes an implementation for a SQLite encryption extension. This extension can be used together with the wxSQLite3 wrapper for wxWidgets, but it can be also used independently for non-wxWidgets-based applications. For the latter the subfolder sqlite3secure/build contains build files for generating a stand-alone SQLite3 library or DLL with encryption support. Additionally, building a SQLite3 shell application is also possible.

In 2017 I was asked whether it would be possible to add support for the SQLite ICU extension. Therefore the build files include configurations for ICU support. However, successfully building SQLite with ICU support requires to install the required ICU components. For details see readme precompiled in subfolder sqlite3secure.

The wxSQLite3 wrapper for wxWidgets currently does not include ICU support out of the box.

Regards,

Ulrich
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: wxsqlite3 in eigenes Projekt einfügen

Post by Wolfgang »

utelle wrote:
Wolfgang wrote:Additional info:

The sqlite3secure was not able to compile without errors:

Code: Select all

Severity	Code	Description	Project	File	Line	Suppression State
Error	C1083	Cannot open include file: 'unicode/utypes.h': No such file or directory	sqlite3libicu	d:\wxwidgets-3.1.2\1own\hadevarim\wxsqlite3-master\sqlite3secure\src\sqlite3.c	185390	
Error	C1083	Cannot open include file: 'unicode/utypes.h': No such file or directory	sqlite3dllicu	d:\wxwidgets-3.1.2\1own\hadevarim\wxsqlite3-master\sqlite3secure\src\sqlite3.c	185390	
Error	LNK1104	cannot open file 'icuind.lib'	sqlite3shellicu	D:\wxWidgets-3.1.2\1own\hadevarim\wxsqlite3-master\sqlite3secure\build\LINK	1	
It is unclear what you are trying to accomplish.

wxSQLite3 includes an implementation for a SQLite encryption extension. This extension can be used together with the wxSQLite3 wrapper for wxWidgets, but it can be also used independently for non-wxWidgets-based applications. For the latter the subfolder sqlite3secure/build contains build files for generating a stand-alone SQLite3 library or DLL with encryption support. Additionally, building a SQLite3 shell application is also possible.

In 2017 I was asked whether it would be possible to add support for the SQLite ICU extension. Therefore the build files include configurations for ICU support. However, successfully building SQLite with ICU support requires to install the required ICU components. For details see readme precompiled in subfolder sqlite3secure.

The wxSQLite3 wrapper for wxWidgets currently does not include ICU support out of the box.

Regards,

Ulrich
Was just trying to batch compile everything.
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: wxsqlite3 in eigenes Projekt einfügen

Post by Wolfgang »

Kvaz1r wrote:
Wolfgang wrote: Did remember now, that I did manage to compile the samples, but for that I had to copy the wxsqlite.h files to the include/wx of the wxwidgets folder.
Why do you need move or copy the files anywhere?

Build sample and if it compiles and runs correctly look as included library files and do same in your project like you already did for wxWidgets itself.
I guess there started the problem, I did not make it right from the beginning I used the sample of minimal and did go on with that, so somehow I never really included it right.
So when I now had to include the wxsqlite3 i included the files, but somehow my original setup was not correct, also it only showed the mistake when I included wxsqlite3. Funny part, I could include wxsqlite3 and compile it, but as soon as I used a command from it, I had errors.

I was able to add the sample project treeview into my solution and also compile it. From then I did know somehow the original setup is not right.

As I'm still in the beginning of the project, I used the working framework of the sample of sqlite3, and changed it to my suiting.
Post Reply