Home » Developer & Programmer » Precompilers, OCI & OCCI » compiling C++ code with Pro*C (10g, Unix)
compiling C++ code with Pro*C [message #320572] Thu, 15 May 2008 08:55 Go to next message
xyzt
Messages: 27
Registered: April 2008
Junior Member
Hello,

I try to compile a simple C++ code using Pro*C like this:
proc CODE=CPP test.cpp

but i get these errors:

Pro*C/C++: Release 9.2.0.7.0 - Production on Thu May 15 16:39:27 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

System default option values taken from: /data06/app/oracle/product/9.2/precomp/admin/pcscfg.cfg

Error at line 1, column 10 in file test.cpp
#include <iostream>
.........1
PCC-S-02015, unable to open include file
Error at line 2, column 10 in file test.cpp
#include <vector>
.........1
PCC-S-02015, unable to open include file
Semantic error at line 25, column 23, file test.cpp:
EXEC SQL CONNECT :userid;
......................1
PCC-S-02322, found undefined identifier
Semantic error at line 32, column 41, file test.cpp:
EXEC SQL FETCH emp_cursor INTO :emp;
........................................1
PCC-S-02322, found undefined identifier


here's the C++ code:
#include <iostream>
#include <vector>
using namespace std;
struct Employee
{
    char name[50];
}emp;
class EmployeeManager{
private:
    EmployeeManager(){

    }
    static EmployeeManager* mngr;
public:
    vector<Employee> emp_list();
    static EmployeeManager* create(){
        if (mngr==NULL)
            mngr = new EmployeeManager();
        return mngr;
    }
};
vector<Employee> EmployeeManager::emp_list(){
    vector<Employee> l;
    EXEC SQL WHENEVER SQLERROR do sql_error("Oracle error");
    EXEC SQL CONNECT :userid;
    EXEC SQL DECLARE emp_cursor CURSOR FOR
                SELECT ename from emp;
    EXEC SQL OPEN emp_cursor;
    EXEC SQL WHENEVER NOT FOUND DO break;
    while(1)
    {
        EXEC SQL FETCH emp_cursor INTO :emp;
        l.push_back(emp);
    }
    EXEC SQL CLOSE emp_cursor;
    EXEC SQL COMMIT WORK RELEASE;
}
int main(){
    return 0;
}


Pro*C complains about something which don't seem erroneous so, what can be the problem?
Re: compiling C++ code with Pro*C [message #337627 is a reply to message #320572] Thu, 31 July 2008 08:02 Go to previous message
vnammour
Messages: 4
Registered: July 2008
Location: Jerusalem, Palestine
Junior Member
I have the same exact problem. Did you find out how to solve it.
Thanks in advance.

[Updated on: Thu, 31 July 2008 08:04]

Report message to a moderator

Previous Topic: With statement over oci
Next Topic: Declare Table ....Semantics
Goto Forum:
  


Current Time: Tue Dec 06 02:23:39 CST 2016

Total time taken to generate the page: 0.07314 seconds