[Orclib-devel] trouble building the C++ example code
Open source C and C++ library for accessing Oracle Databases
Brought to you by:
vince_del_paris
|
From: Christoph D. <du...@me...> - 2015-02-17 10:46:42
|
Trying to build the .cpp example program from the website
#include "ocilib.hpp"
using namespace ocilib;
int main(void)
{
try
{
Environment::Initialize();
Connection con("db", "usr", "pwd");
Statement st(con);
st.Execute("select * from products");
Resultset rs = st.GetResultset();
while (rs.Next())
{
std::cout << "code:" << rs.Get<int>(1) << " name: " <<
rs.Get<ostring>(2) << std::endl;
}
std::cout << "=> Total fetched rows : " << rs.GetCount() <<
std::endl;
}
catch(Exception &ex)
{
std::cout << ex.GetMessage() << std::endl;
}
Environment::Cleanup();
return EXIT_SUCCESS;
}
I get compile errors using clang++ (version 3.1), or g++ (4.3.6):
(I am running OpenSuSE linux 11.4).
Use clang++/g++ call:
clang++ -c -Wall -I $OCILIB/include -o .obj/ocilibtest.o ocilibtest.cpp
Output of g++
g++ -c -Wall -I /usr/local/melos/3rdparty/ocilib/include -o
.obj/ocilibtest.o ocilibtest.cpp
In file included from
/usr/local/melos/3rdparty/ocilib/include/ocilib.hpp:8183,
from ocilibtest.cpp:36:
/usr/local/melos/3rdparty/ocilib/include/ocilib_impl.hpp: In member
function 'void ocilib::HandleHolder<THandleType>::Acquire(THandleType,
int (*)(void*), ocilib::Handle*)':
/usr/local/melos/3rdparty/ocilib/include/ocilib_impl.hpp:386: error:
expected type-specifier
/usr/local/melos/3rdparty/ocilib/include/ocilib_impl.hpp:386: error:
expected `>'
/usr/local/melos/3rdparty/ocilib/include/ocilib_impl.hpp:386: error:
expected `('
/usr/local/melos/3rdparty/ocilib/include/ocilib_impl.hpp:386: error:
expected primary-expression before '>' token
/usr/local/melos/3rdparty/ocilib/include/ocilib_impl.hpp:386: error:
expected `)' before ';' token
/usr/local/melos/3rdparty/ocilib/include/ocilib_impl.hpp:390: error:
expected type-specifier
/usr/local/melos/3rdparty/ocilib/include/ocilib_impl.hpp:390: error:
expected `;
...
Output of clang++:
clang++ -c -Wall -I /usr/local/melos/3rdparty/ocilib/include -o
.obj/ocilibtest.o ocilibtest.cpp
In file included from ocilibtest.cpp:36:
/usr/local/melos/3rdparty/ocilib/include/ocilib.hpp:4612:39: error: no
class named 'Iterator' in 'Collection<TDataType>'
friend class Collection<TDataType>::Iterator;
~~~~~~~~~~~~~~~~~~~~~~~^
In file included from ocilibtest.cpp:36:
In file included from
/usr/local/melos/3rdparty/ocilib/include/ocilib.hpp:8183:
/usr/local/melos/3rdparty/ocilib/include/ocilib_impl.hpp:838:23: error:
no matching function for call to 'OCI_ErrorGetString'
return MakeString(OCI_ErrorGetString(*this));
^~~~~~~~~~~~~~~~~~
/usr/local/melos/3rdparty/ocilib/include/ocilib.h:1969:34: note:
candidate function not viable: no known conversion from 'const
ocilib::Exception' to 'OCI_Error *' for 1st argument;
OCI_EXPORT const otext * OCI_API OCI_ErrorGetString
^
....
Is building the C++ code under linux known to work?
Best regards
--
Christoph Duelli
---------------------------------------------------------------------------------
MELOS-Medizinische Labor-Organisations-Systeme GmbH
Franz-Beer-Straße 6
86459 Gessertshausen
Tel.: +49 8238/9611-0
Fax: +49 8238/9611-99
mailto: in...@me...
URL: www.melosgmbh.de
Amtsgericht Augsburg, HRB 13226
USt-IdNr. DE 130 958 139
Geschäftsführer:
Herbert Mayer, Andreas Manntz, Helmut Welsch
--------------------------------------------
This e-mail (including any attachments) is confidential and may be privileged. If you have received it by mistake, please notify the sender by e-mail and delete it from your system.
Any unauthorised use or dissemination of this e-mail or its contents in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change.
MELOS GmbH shall not be liable for the improper or incomplete transmission of the information contained in this communication nor for any delay in its receipt.
MELOS GmbH does not guarantee that the integrity of this communication has been maintained nor that this communication is free of viruses, interceptions or interference.
|