Home » Developer & Programmer » Precompilers, OCI & OCCI » error in C++ and occi call and Errors in OCCI header files. (oracle 11gr2, centos 7.5, centos 6.10)
error in C++ and occi call and Errors in OCCI header files. [message #679288] Thu, 20 February 2020 01:54 Go to next message
rahulvishwakarma
Messages: 11
Registered: April 2014
Junior Member
hi to all, i am using cntos7.5 as client and centos 6.10 as oracle 11gR2 server both in VM. I am trying to build a c++ program in which i called occi call interface. but having this error.
opt/oracle/instantclient_11_2/sdk/include/occiControl.h|986|error: expected identifier before ‘int’|
/opt/oracle/instantclient_11_2/sdk/include/occiControl.h|987|error: expected unqualified-id before ‘{’ token|

/opt/projects/codeblocks/c++/cbs/cbs/src/product_record.cpp|16|warning: unused variable ‘stmt’ [-Wunused-variable]|
/opt/oracle/instantclient_11_2/sdk/include/occiControl.h|1257|error: expected identifier before ‘int’|
/opt/oracle/instantclient_11_2/sdk/include/occiControl.h|1258|error: expected unqualified-id before ‘{’ token|
/opt/oracle/instantclient_11_2/sdk/include/occiControl.h|1387|error: expected identifier before ‘int’|
/opt/oracle/instantclient_11_2/sdk/include/occiControl.h|1387|error: expected unqualified-id before ‘{’ token|
source code is :-

product_record.h:-
#ifndef PRODUCT_RECORD_H
#define PRODUCT_RECORD_H

#include <string>
#include <occiControl.h>
#include <occi.h>
#include <string>

using namespace std;
using namespace oracle::occi;

class product_record
{
    public:
        product_record();
        virtual ~product_record();
        product_record(const product_record& other);
        product_record& operator=(const product_record& other);


        void product_Enter();
        void read_Product();
        void modify_Product();

    protected:
    private:

        Environment *env;
        Connection *conn;

        Statement *stmt;

        string strstmt;
};

#endif // PRODUCT_RECORD_H
product_record.cpp
#include "product_record.h"

using namespace oracle::occi;
using namespace std;

product_record::product_record()
{
    //ctor

    const string user="rahul", passwd = "rahul", connstring = "orcl";

    env =  Environment::createEnvironment();

    conn = env->createConnection(user, passwd, connstring);

    Statement *stmt = conn->createStatement(strstmt);
}

product_record::~product_record()
{
    //dtor
    conn->terminateStatement(stmt);
    env->terminateConnection(conn);

    Environment::terminateEnvironment(env);
}

product_record::product_record(const product_record& other)
{
    //copy ctor
}

product_record& product_record::operator=(const product_record& rhs)
{
    if (this == &rhs) return *this; // handle self assignment
    //assignment operator
    return *this;
}

void product_record::product_Enter()
{
    stmt = conn->createStatement(strstmt);
}

void product_record::read_Product()
{

}

void product_record::modify_Product()
{

}
how to recover this error.
Re: error in C++ and occi call and Errors in OCCI header files. [message #679342 is a reply to message #679288] Mon, 24 February 2020 06:29 Go to previous message
NevemTeve
Messages: 7
Registered: November 2017
Junior Member
Couldn't reproduce the problem (Linux/AIX, oracle-client 10/11/12). It's interesting though that all three problematic lines begin with `enum Status`. Did you do some tinkering with Status? (e.g. -DStatus=int)
     1  /* Copyright  Oracle Corporation 2000, 2006. All Rights Reserved. */ 
     2   
     3  /* 
     4     NAME 
     5       occiControl.h - header file for OCCI control classes
-
   986    enum Status
-
  1257    enum Status
-
  1387      enum Status {READY_FOR_READ, READY_FOR_WRITE, INACTIVE};
-

[Updated on: Mon, 24 February 2020 06:33]

Report message to a moderator

Previous Topic: In Pro*C, can UPDATE return sqlca.sqlcode=1403 ?
Next Topic: Pro*C and 2 databases
Goto Forum:
  


Current Time: Wed Sep 23 05:16:24 CDT 2020