sql。虽然安装了unixODBC,但仍丢失了h头文件。

时间:2022-07-27 04:36:23

I am on an up-to-date Ubuntu 12.04 system. I have unixodbc (v2.2.14 from ubuntu repos), MySQL and its relevant drivers installed. Also connected to a valid DSN. Verified by issuing isql DBName UName passwd.

我正在使用最新的Ubuntu 12.04系统。我有unixodbc(来自ubuntu repos的v2.2.14)、MySQL及其相关驱动程序。也连接到一个有效的DSN。通过发布isql DBName UName passwd验证。

I am trying to compile a C application that interacts with the database using ODBC. Almost everywhere I searched seemed to indicate that I should have "sql.h" installed somewhere. A find / -iname sql.h -print showed I don't have it.

我正在尝试编译一个使用ODBC与数据库交互的C应用程序。几乎所有我搜索的地方似乎都表明我应该有“sql”。h”安装。一个find / -iname sql。h -print显示我没有。

So my question is: where is it? Did something go wrong with the install (no errors were reported though)? And what steps do you recommend? Reinstallation? Compilation from source code (the latest version?)?

我的问题是:它在哪里?安装是否出了问题(不过没有报告错误)?你有什么建议吗?重新安装吗?从源代码编译(最新版本?)

1 个解决方案

#1


22  

You need to install the unixodbc-dev package to get the development header files.

您需要安装unixodbc-dev包以获得开发头文件。

sudo apt-get install unixodbc-dev

The -dev packages contain the require header files required to compile and build programs using these headers to make calls to the library. The library files themselves would be part of the regular package i.e. unixodbc in your case.

-dev包中包含编译和构建程序所需的头文件,它们使用这些头文件对库进行调用。库文件本身就是常规包的一部分,即在您的例子中是unixodbc。

If you want to know which package provides a certain file, you could use apt-file:

如果您想知道哪个包提供了某个文件,您可以使用apt-file:

sudo apt-file update
sudo apt-file find sql.h

#1


22  

You need to install the unixodbc-dev package to get the development header files.

您需要安装unixodbc-dev包以获得开发头文件。

sudo apt-get install unixodbc-dev

The -dev packages contain the require header files required to compile and build programs using these headers to make calls to the library. The library files themselves would be part of the regular package i.e. unixodbc in your case.

-dev包中包含编译和构建程序所需的头文件,它们使用这些头文件对库进行调用。库文件本身就是常规包的一部分,即在您的例子中是unixodbc。

If you want to know which package provides a certain file, you could use apt-file:

如果您想知道哪个包提供了某个文件,您可以使用apt-file:

sudo apt-file update
sudo apt-file find sql.h