1

I am trying to compile an existing C++ project but get this error:

 fatal error C1083: Cannot open include file: 'occi.h': No such file or directory

What I did is I went to this link:

http://www.oracle.com/technetwork/topics/winsoft-085727.html

and downloaded the first (basic) package.

Then unzipped the folder and modified PATH variable like this:

C:\Program Files\Atmel\sam-ba_2.12\drv\;C:\Program Files\Atmel\sam-ba_2.12;C:\Program Files\ATMEL Corporation\AT91-ISP v1.4\Library;C:\MSYS\1.0\bin;C:\MSYS\1.0\local\bin;C:\cygnus\cygwin-b20\H-i586-cygwin32\bin;D:\instantclient_12_1

last being path to oracle. But I still get the error, can someone help?

PS I noticed in my project there are lines like:

#include "occi.h"

Maybe it is because of this?

  • 3
    You need to specify where the compiler can find that include file using the `-I` option. Setting the `PATH` variable only affects where your system can find executable files or shared libraries. – πάντα ῥεῖ Aug 18 '15 at 11:44
  • why downvote? I asked clear question, and mentioned what I tried –  Aug 18 '15 at 12:02

1 Answers1

3

The basic package isn't enough. Its description says "All files required to run OCI, OCCI, and JDBC-OCI application" (emphasis added); with just that you can run an OCI program, but you can't compile one. You need to download other instant client components. Specifically for the occi.h header you need the fifth file listed:

*Instant Client Package - SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client

If you download and unzip that in the same place you unzipped the basic package, your instant client directory will gain an sdk folder, which includes all the OCI header files.

You'll then need to compile with -I D:\instantclient_12_1\sdk\include so your compiler knows where to look for the occi.h and other header files. You may also need -L to tell it where to find the Oracle libraries; presumably you already have -lclntsh and/or -locci, which refer to libraries you should have already from the basic package.

Alex Poole
  • 183,384
  • 11
  • 179
  • 318
  • @user200399 - I don't use that, but [this question might show you what you need to do](http://stackoverflow.com/q/2676417/266304). – Alex Poole Aug 18 '15 at 12:03
  • `Project->Properties->Configuration Properties->C/C++->Additional Include Directories` and add path to your instantclient/include folder. – Elvis Oric Aug 18 '15 at 12:06
  • As @Alex Poole already said, you also need to tell linker where to find Oracle libraries, you can do that with : `Project->Properties->Configuration Properties->Linker->General->Additional Library Directories` and add path to your sdk/lib/msvc. – Elvis Oric Aug 18 '15 at 12:18
  • I am using VS 2017. I have Oracle 19.13.0 installed. I downloaded Intantclient_19_18 ( instantclient-sdk-windows.x64-19.18.0.0.0dbru.zip) and unzipped in my C: folder. Then I followed @ElvisOric comments to set paths to the instant client include and Linker to sdk/lib/msvc paths. Now, I am no longer getting "Cannot open include file occi.h, no such file or directory" but instead I am getting error ***LNK1181 cannot open input file 'C:\instantclient_19_3\sdk\lib\msvc\oraocci19d.lib'***. Any help is highly appreciated – cd491415 May 10 '23 at 21:49