The following information applies for installing libodbc++ on unices.
First, you need to configure libodbc++ for your system. Go into the source directory and do
$ ./configure
or, if iODBC isn't installed in it's default location /usr/local, do
$ ./configure --with-iodbc=DIR
This will make ./configure look for iODBC in DIR/include/ and DIR/lib/.
If you aren't using iODBC, try
$ ./configure --with-odbc=DIR
Works the same as above, except it looks for standard ODBC headers and libraries instead of the iODBC ones. This should be used with for example unixODBC and Intersolv.
If you wish to install libodbc++ in a location other than /usr/local, add
--prefix=PREFIX
to the ./configure arguments.
If the c++ compiler you wish to use to compile this package isn't the system
default one, you will need to set the environment variable CXX
to
the name of it's executable. For example, if you have an old gcc
or
egcs
as a system default compiler, but installed a newer
gcc
with prefix /usr/local/gcc, do like this:
$ CXX=/usr/local/gcc/bin/c++ ./configure --with-iodbc
If you wish to enable support for multithreaded programs, add
--enable-threads
to the ./configure arguments.
This requires a POSIX compliant pthreads implementation on UNIX.
If you wish to enable support for QT, use the --with-qt
argument. You can optionally specify where your QT lives by using
--with-qt=/path/to/qt
. The --with-qt-includes
,
--with-qt-libs
and --with-moc
options might be handy if you have a
strange QT installation. This will compile a second version of the library
named libodbc++_qt in the subdirectory qt.
Note that you must #define ODBCXX_QT
when compiling a program
that links with libodbc++_qt.
You can control the ODBC version libodbc++ uses by specifying:
--with-odbc-version=ODBCVER
, where ODBCVER
should be a
four-digit hexadecimal value. For example 0x0250
means
ODBC 2.50.
Just type
$ make
If it all goes well, you can try a couple of the test programs in tests/. You'll need to configure some datasources before running most of the tests. For simply reality-checking your current ODBC setup, you can try running tests/dmtest, which lists all available datasources and drivers.
If you have write privileges in PREFIX
, just do
$ make install
Otherwise, you'll have to use
$ su root -c 'make install'
If you are using linux, now is a good time to run
$ su root -c '/sbin/ldconfig'
to update your dynamic linker's cache.
A makefile for win32 is provided in the win32 directory of the source distribution. Use
nmake /f makefile.w32 CFG=<config>
where <config>
is one of:
debug-lib
- Static library with debugging information. Builds
odbc++sd.lib in the debug-lib subdirectory.debug-dll
- Shared library with debugging information. Builds
odbc++d.lib and odbc++d.dll in the debug-dll
subdirectory.prod-lib
- Production static library. Builds odbc++s.lib
in the prod-lib subdirectory.prod-dll
- Production shared library. Builds odbc++.lib
and odbc++.dll in the prod-dll subdirectory.qt-debug-lib
- Static library with QT and debugging information.
Builds odbc++qtsd.lib in the qt-debug-lib subdirectory.qt-debug-dll
- Shared library with QT and debugging information.
Builds odbc++qtd.lib and odbc++qtd.dll in the
qt-debug-dll subdirectory.qt-prod-lib
- Production static library with QT. Builds
odbc++qts.lib in the qt-prod-lib subdirectory.qt-prod-dll
- Production shared library with QT. Builds
odbc++qt.lib and odbc++qt.dll in the
qt-prod-dll subdirectory.When bulding with QT, make sure you have your environment set up right. QTDIR
must point to a directory that contains the include
and lib
subdirectories
for QT. The makefile will assume version 202 (2.0.2) of QT. To override that,
pass QT_VERSION=nnn
to nmake
, for example:
nmake /f makefile.w32 CFG=qt-debug-dll QT_VERSION=201
will build libodbc++ against version 2.0.1 of QT.
Note that when compiling an application against libodbc++
compiled as
a DLL, you have to define the macro ODBCXX_DLL
before including any
library header files.
A makefile for compiling the tests can be found in the win32/tests subdirectory. Build the debug-lib version of the library, and use
nmake /f makefile.w32
to build them.