INSTALLING wxSqlite3

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
wash4
Earned a small fee
Earned a small fee
Posts: 17
Joined: Sat Nov 05, 2011 6:06 pm

INSTALLING wxSqlite3

Postby wash4 » Sat Nov 05, 2011 6:24 pm

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:

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

Re: INSTALLING wxSqlite3

Postby utelle » Sat Nov 05, 2011 9:12 pm

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

wash4
Earned a small fee
Earned a small fee
Posts: 17
Joined: Sat Nov 05, 2011 6:06 pm

Re: INSTALLING wxSqlite3

Postby wash4 » Sun Nov 06, 2011 2:01 pm

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 ??

cecilio
I live to help wx-kind
I live to help wx-kind
Posts: 189
Joined: Fri Dec 03, 2004 8:44 am
Location: spain
Contact:

Re: INSTALLING wxSqlite3

Postby cecilio » Sun Nov 06, 2011 4:48 pm

Did you add:
#include "wx/wxsqlite3.h"

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

wash4
Earned a small fee
Earned a small fee
Posts: 17
Joined: Sat Nov 05, 2011 6:06 pm

Re: INSTALLING wxSqlite3

Postby wash4 » Sun Nov 06, 2011 4:59 pm

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???

cecilio
I live to help wx-kind
I live to help wx-kind
Posts: 189
Joined: Fri Dec 03, 2004 8:44 am
Location: spain
Contact:

Re: INSTALLING wxSqlite3

Postby cecilio » Sun Nov 06, 2011 5:35 pm

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

wash4
Earned a small fee
Earned a small fee
Posts: 17
Joined: Sat Nov 05, 2011 6:06 pm

Re: INSTALLING wxSqlite3

Postby wash4 » Sun Nov 06, 2011 6:59 pm

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()';

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

Re: INSTALLING wxSqlite3

Postby utelle » Sun Nov 06, 2011 8:34 pm

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

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 258
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: INSTALLING wxSqlite3

Postby raananb » Fri Jan 06, 2012 2:29 pm

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?

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

Re: INSTALLING wxSqlite3

Postby utelle » Fri Jan 06, 2012 6:42 pm

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

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 258
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: INSTALLING wxSqlite3

Postby raananb » Sat Jan 07, 2012 6:59 am

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

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

Re: INSTALLING wxSqlite3

Postby utelle » Sat Jan 07, 2012 6:47 pm

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

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 258
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: INSTALLING wxSqlite3

Postby raananb » Sun Jan 08, 2012 1:40 pm

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?

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

Re: INSTALLING wxSqlite3

Postby utelle » Sun Jan 08, 2012 3:40 pm

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

Ranjit
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Feb 06, 2015 9:25 am

Re: INSTALLING wxSqlite3

Postby Ranjit » Fri Feb 06, 2015 9:38 am

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


Return to “wxCode”

Who is online

Users browsing this forum: No registered users and 1 guest