C语言 尽管安装了 unixODBC,但缺少 sql.h 头文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15447386/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
sql.h header file missing though unixODBC is installed
提问by Richard
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 -printshowed I don't have it.
我正在尝试编译一个使用 ODBC 与数据库交互的 C 应用程序。我搜索的几乎所有地方似乎都表明我应该在某处安装“sql.h”。Afind / -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?)?
所以我的问题是:它在哪里?安装有问题吗(虽然没有报告错误)?您建议采取哪些步骤?重装?从源代码编译(最新版本?)?
回答by Tuxdude
You need to install the unixodbc-devpackage to get the development header files.
您需要安装该unixodbc-dev软件包以获取开发头文件。
sudo apt-get install unixodbc-dev
The -devpackages 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. unixodbcin 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

