I have already added the include folder inside SQLAPI to my ldconf file.
but still when I am attempting to compile the code i receive the following error:
g++ connectDB.cpp -lsqlapi
connectDB.cpp:2:44: error: SQLAPI.h: No such file or directory
In file included from /usr/lib/gcc/i486-slackware-linux/4.2.4/../../../../include/c++/4.2.4/backward/iostream.h:31,
from connectDB.cpp:3:
/usr/lib/gcc/i486-slackware-linux/4.2.4/../../../../include/c++/4.2.4/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
connectDB.cpp: In function 'int main(int, char**)':
connectDB.cpp:8: error: 'SAConnection' was not declared in this scope
connectDB.cpp:8: error: expected `;' before 'con'
connectDB.cpp:16: error: 'con' was not declared in this scope
connectDB.cpp:20: error: 'SA_Oracle_Client' was not declared in this scope
connectDB.cpp:30: error: expected type-specifier before 'SAException'
connectDB.cpp:30: error: expected `)' before '&' token
connectDB.cpp:30: error: expected `{' before '&' token
connectDB.cpp:30: error: 'x' was not declared in this scope
connectDB.cpp:30: error: expected `;' before ')' token
connectDB.cpp:49: error: expected `}' at end of input
and the following is the code:
#include <stdio.h> // for printf
#include <SQLAPI.h> // main SQLAPI++ header
#include <iostream.h>
int main(int argc, char* argv[])
{
SAConnection con; // create connection object
try
{
// connect to database
// in this example it is Oracle,
// but can also be Sybase, Informix, DB2
// SQLServer, InterBase, SQLBase and ODBC
con.Connect(
"test", // database name
"tester", // user name
"tester", // password
SA_Oracle_Client);
printf("We are connected!\n");
// Disconnect is optional
// autodisconnect will ocur in destructor if needed
con.Disconnect();
printf("We are disconnected!\n");
}
catch(SAException &x)
{
// SAConnection::Rollback()
// can also throw an exception
// (if a network error for example),
// we will be ready
try
{
// on error rollback changes
con.Rollback();
}
catch(SAException &)
{
}
// print error message
printf("%s\n", (const char*)x.ErrText());
}
return 0;
}
any helps will be appreciable.
Your
Saman

New Topic/Question
Reply



MultiQuote




|