Page 1 of 2

INSTALLING wxSqlite3

Posted: Sat Nov 05, 2011 6:24 pm
by wash4
Could anybody explain step by step how to install wxSqlite3?
System: windows, IDE: Codelite +wxWidgets, compiler: minGW.
I downloaded wxSqlite3, unzip but I don´t know how to set linker, compiler.... or where put those files.

Thanks :wink:

Re: INSTALLING wxSqlite3

Posted: Sat Nov 05, 2011 9:12 pm
by utelle
wash4 wrote:Could anybody explain step by step how to install wxSqlite3?
System: windows, IDE: Codelite +wxWidgets, compiler: minGW.
I downloaded wxSqlite3, unzip but I don´t know how to set linker, compiler.... or where put those files.
Just as wxWidgets itself wxSQLite3 comes along with build files created by bakefile. Currently bakefile does not support generating project files for CodeLite or Code::Blocks. I plan to add support for premake (which in turn supports generating project files for several IDEs) in a future release of wxSQLite3 but I don't have a fixed schedule yet.

Since wxSQLite3 consists only of a single C++ source file and a few header files the simplest approach is to add those files directly to your own project. Additionally you have to set an include path to the sqlite3/include directory within the wxSQLite3 folder and depending on how you intend to link to SQLite3 itself you have to add the SQLite3 link library located in sqlite3/lib (original SQLite3 version) or sqlite3/secure/aes128 resp. sqlite3/secure/aes256 (in case you want to use the SQLite3 version with encryption support).

Regards,

Ulrich

Re: INSTALLING wxSqlite3

Posted: Sun Nov 06, 2011 2:01 pm
by wash4
Thanks for help, I handle it. Anyway I started to working with that, and copy from sample which was included:
wxSQLite3Database* initDB(void)
{
wxString testDBName = wxGetCwd() + wxT("/test2.db");
if (wxFileExists(testDBName))
{
wxRemoveFile(testDBName);
}
wxSQLite3Database* db = new wxSQLite3Database(); /line 64
db->Open(testDBName); /line 65
db->ExecuteUpdate(wxT("CREATE TABLE test (col1 INTEGER)"));
return db;
}

Compiler returns:
64: undefined reference to `wxSQLite3Database::Open(wxString const&, wxString const&, int)'
65: undefined reference to `wxSQLite3Database::Open(wxString const&, wxString const&, int)'

Could anybody know where could be problem??? Or is there any tutorial how to get it work like createing db, opening, begin transaction ??

Re: INSTALLING wxSqlite3

Posted: Sun Nov 06, 2011 4:48 pm
by cecilio
Did you add:
#include "wx/wxsqlite3.h"

and changed your makefile or project file to include a ref to the sqlite3 library/dll?

Re: INSTALLING wxSqlite3

Posted: Sun Nov 06, 2011 4:59 pm
by wash4
cecilio wrote:Did you add:
#include "wx/wxsqlite3.h"

and changed your makefile or project file to include a ref to the sqlite3 library/dll?

Yes I've included wx/wxsqlite3.h, and how could I change project file to include a ref to the sqlite3 library/dll???

Re: INSTALLING wxSqlite3

Posted: Sun Nov 06, 2011 5:35 pm
by cecilio
I know nothing about Codelite. But these are the changes for CodeBlocks and MS VisualStudio. Perhaps it can help you:

1. MS Visual Studio project file (Sorry, my version is in Spanish. I add approx. translation)
==================================================

C/C++
General
Directorios de inclusion adicionales (~= additional include paths)
..\..\packages\wxSQLite3\include
..\..\packages\wxSQLite3\sqlite3\include

Vinculador (~= Linker)
General
Directorios de biblioteca adicionales (~= additional paths)
..\..\packages\wxSQLite3\sqlite3\lib

Entrada (~=input files)
Dependencias adicionales (~= additional dependencies)
sqlite3.lib


In sources to compile add:
packages\wxSQLite3\src\wxsqlite3.cpp


2. Codeblocks project file
==================================================

Build options:
- Search directories
../../packages/wxSQLite3/include
../../packages/wxSQLite3/sqlite3/include

Alternatively, it is better to use installed package:

- Linker settings:
Link libraries:
/usr/local/lib/libsqlite3.a

In sources to compile add:
packages/wxSQLite3/src/wxsqlite3.cpp

Re: INSTALLING wxSqlite3

Posted: Sun Nov 06, 2011 6:59 pm
by wash4
utelle wrote:
wash4 wrote:Could anybody explain step by step how to install wxSqlite3?
System: windows, IDE: Codelite +wxWidgets, compiler: minGW.
I downloaded wxSqlite3, unzip but I don´t know how to set linker, compiler.... or where put those files.
Just as wxWidgets itself wxSQLite3 comes along with build files created by bakefile. Currently bakefile does not support generating project files for CodeLite or Code::Blocks. I plan to add support for premake (which in turn supports generating project files for several IDEs) in a future release of wxSQLite3 but I don't have a fixed schedule yet.

Since wxSQLite3 consists only of a single C++ source file and a few header files the simplest approach is to add those files directly to your own project. Additionally you have to set an include path to the sqlite3/include directory within the wxSQLite3 folder and depending on how you intend to link to SQLite3 itself you have to add the SQLite3 link library located in sqlite3/lib (original SQLite3 version) or sqlite3/secure/aes128 resp. sqlite3/secure/aes256 (in case you want to use the SQLite3 version with encryption support).

Regards,

Ulrich
Thanks for help, could you specify what could I include to where ? (linker,compiler), I also tried but getting errors : undefined reference to `wxSQLite3Database::wxSQLite3Database()';

Re: INSTALLING wxSqlite3

Posted: Sun Nov 06, 2011 8:34 pm
by utelle
wash4 wrote:could you specify what could I include to where ? (linker,compiler), I also tried but getting errors : undefined reference to `wxSQLite3Database::wxSQLite3Database()';
I don't know CodeLite so I can't give specific advice. The error message seems to be issued by the linker. This means you didn't add the wxSQLite3 sources to your project as I advised you to do in my first post.

You have to add all wxSQLite3 source files to your project (check the documentation of CodeLite how to do it in your IDE). All paths are given relative to the base directory of the wxSQLite3 file release.

compiler:
src/wxsqlite3.cpp
include/wx/wxsqlite3def.h
include/wx/wxsqlite3.h
include/wx/wxsqlite3dyn.h
include/wx/wxsqlite3opt.h

In the header file wxsqlite3opt.h you find several compile time options you may want to change according to your needs.

Additionally you need to specify an additional include directory for the compiler:

sqlite3/include

linker:
reference to SQLite3 link library - if you decide to not load the SQLite DLL dynamically. For MinGW one of the following:

a) sqlite3/lib/sqlite3.a
b) sqlite3/secure/aes128/sqlite3.a
c) sqlite3/secure/aes128/sqlite3.a

Note:
a) original SQLite version,
b) version with AES 128 bit encryption support
c) version with AES 256 bit encryption support

Choose the version which suits your needs best.

It might be necessary to rename the link library sqlite3.a to libsqlite3.a, since as far as I know the GNU linker expects library names without "lib" prefix, but library files named including the prefix.

Regards,

Ulrich

Re: INSTALLING wxSqlite3

Posted: Fri Jan 06, 2012 2:29 pm
by raananb
Downloaded 2.3.1 to windows & Visual C++ 2010 Express.

Opened wxsqlite3_vc9.sln from Build folder, which was conveted by VC++.

Tried to compile as Staitc Unicode Debug Monilithic static, and got "1>..\src\wxsqlite3.cpp(18): fatal error C1083: Cannot open include file: 'wx/wxprec.h': No such file or directory"

Opened wxsqlite3_vc9_wxsqlite3.vcproj, which was converted to wxsqlite3_vc9_wxsqlite3.vcxproj, but which evidently generated the same error message.

It is unfortunate that the solution is not set to enable direct compilation, since any user project requires the libraries, which must be generated.

Am I expecing too much?

Re: INSTALLING wxSqlite3

Posted: Fri Jan 06, 2012 6:42 pm
by utelle
raananb wrote:Downloaded 2.3.1 to windows & Visual C++ 2010 Express.

Opened wxsqlite3_vc9.sln from Build folder, which was conveted by VC++.

Tried to compile as Staitc Unicode Debug Monilithic static, and got "1>..\src\wxsqlite3.cpp(18): fatal error C1083: Cannot open include file: 'wx/wxprec.h': No such file or directory"
This message indicates that the wxWidgets header files couldn't be found. The cause can only be that the environment variable WXWIN pointing to the root folder of your wxWidgets installation is not defined at all or is pointing to the wrong folder.

For referencing required libraries one must define library paths for the compiler and the linker. There is no way how a VC++ solution/project file could guess where your wxWidgets installation is located. Therefore the environment variable WXWIN is used for this purpose and must be set correctly.
raananb wrote:It is unfortunate that the solution is not set to enable direct compilation, since any user project requires the libraries, which must be generated.
It is a prerequiste for all separate wxWidgets components I know of that wxWidgets is already installed and that all builds of the wxWidgets libraries which are planned to be used were already generated.
raananb wrote:Am I expecing too much?
Whatever you expect you would have to specify in any case where your wxWidgets installation is located. As said there is no way I know of how to detect this from a VC++ solution automatically. If you know better let me know.

The only way to guarantee that the wxWidgets prerequisite is fulfilled would be to bundle the complete wxWidgets source code with wxSQLite3. You can't seriously expect that, can you?

As all wxWidgets components wxSQLite3 is meant for developers and IMHO a developer should be able to inspect the compiler settings. There you would see immediately that the paths to wxWidgets are defined based on the variable WXWIN. And then checking your environment would reveal either that it doesn't exist or that it isn't correctly defined.

Regards,

Ulrich

Re: INSTALLING wxSqlite3

Posted: Sat Jan 07, 2012 6:59 am
by raananb
This is the first time I am using an external component with wxWidgets. Using DialogBlocks simplifies handling global parameters, since it generates project files for VC++, so I was not aware of the specific need to define WXWIN.

Thanks for the information.

Edited 2012-1-7 17:00

Re: INSTALLING wxSqlite3

Posted: Sat Jan 07, 2012 6:47 pm
by utelle
raananb wrote:This is the first time I am using an external component with wxWidgets. Using DialogBlocks simplifies handling global parameters, since it generates project files for VC++, so I was not aware of the specific need to define WXWIN.
DialogBlocks does it for you. If you check the DialogBlocks configuration dialog you'll see under the headings "Paths" the symbol WXWIN among others.

Defining an environment variable isn't specific to VC++. So just locate Windows' extended system configuration dialog where you can add environment variables globally or for your account only..

Regards,

Ulrich

Re: INSTALLING wxSqlite3

Posted: Sun Jan 08, 2012 1:40 pm
by raananb
Dialogblocks has a WXWIN parameter to define the path to wxWidgets, but it does not set this path system-wide. It uses this information to generate vcxproj files with the explicit path. This is why the problem arose in the first place.
(From an earlier post) ... depending on how you intend to link to SQLite3 itself you have to add the SQLite3 link library located in sqlite3/lib (original SQLite3 version) or sqlite3/secure/aes128 resp. sqlite3/secure/aes256 (in case you want to use the SQLite3 version with encryption support).
With wxSqlite3-2.1.3, sqlite3/lib was empty. Is that intended?

Re: INSTALLING wxSqlite3

Posted: Sun Jan 08, 2012 3:40 pm
by utelle
raananb wrote:Dialogblocks has a WXWIN parameter to define the path to wxWidgets, but it does not set this path system-wide. It uses this information to generate vcxproj files with the explicit path. This is why the problem arose in the first place.
I'm not very familiar with DialogBlocks. At least in generated makefiles the symbol WXWIN is used.

If you install wxWidgets from the executable setup for Windows (wxMSW) the environment variable WXWIN is created for you. So using the environment variable WXWIN is very common for wxWidgets on Windows platforms.
raananb wrote:
(From an earlier post) ... depending on how you intend to link to SQLite3 itself you have to add the SQLite3 link library located in sqlite3/lib (original SQLite3 version) or sqlite3/secure/aes128 resp. sqlite3/secure/aes256 (in case you want to use the SQLite3 version with encryption support).
With wxSqlite3-2.1.3, sqlite3/lib was empty. Is that intended?
The wxSQLite3 release archive wxsqlite3-2.1.3.zip contains all Windows specific stuff. The archive wxsqlite3-2.1.3.tar.gz does not as it is meant for Linux and Linux-like systems for which no precompiled link libraries are provided by wxSQLite3.

Regards,

Ulrich

Re: INSTALLING wxSqlite3

Posted: Fri Feb 06, 2015 9:38 am
by Ranjit
Hi Ulrich,

I am working with Video encoding software for HEVC for my study. I came across software that requires wxsqlite3.I am not able to build my HEVC video encoding software because it requires wxcode_msw30ud_wxsqlite3.lib . Can you please provide any help in this.


Thanks,
Ranjit