且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法打开包含文件:'occi.h':没有这样的文件或目录

更新时间:2023-02-23 08:54:07

基本包是不够的。其描述为要求运行 OCI,OCCI和JDBC-OCI应用程序所需的所有文件(强调添加);只是你可以运行OCI程序,但是你不能编译一个。您需要下载其他即时客户端组件。特别是对于 occi.h 标题,您需要列出第五个文件:


即时客户端软件包 - SDK:使用Instant Client开发Oracle应用程序的附加头文件和示例makefile


如果您下载并解压缩在解压缩基本包的同一个地方,您的即时客户端目录将获得一个 sdk 文件夹,其中包括所有OCI头文件。



那么你需要使用 -ID:\instantclient_12_1\sdk\\\\\\\\\\\\\\\\\\\\\\\插件编译,所以你的编译器知道在哪里寻找 occi.h 和其他头文件。您还可能需要 -L 告诉它在哪里找到Oracle库;大概你已经有了 -lclntsh 和/或 -locci ,它们指的是你应该已经从基本包。


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?

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.