找不到#include'mysql/mysql.h'文件-Eclipse/Mac OSX [英] #include 'mysql/mysql.h' file not found - Eclipse / Mac OSX

查看:133
本文介绍了找不到#include'mysql/mysql.h'文件-Eclipse/Mac OSX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Eclipse在Mac上开发c程序,但是却在包括mysql.h在内的最基本任务上苦苦挣扎

I am trying to develop a c program on my Mac using Eclipse, but struggling on the most basic task of including mysql.h

为完整性起见,这是我的代码:

Here is my code for completeness sake:

#include <stdio.h>
#include <stdlib.h>

#include <mysql.h>

int main(void) {

  printf("MySQL client version: %s\n", mysql_get_client_info());
  return EXIT_SUCCESS;

}

我尝试了许多方法:

#include <mysql.h>
#include "mysql.h"
#include <mysql/mysql.h>
#include "mysql/mysql.h"

但是,在编译'mysql/mysql.h'文件未找到"时,我总是收到消息

however I always get the message when compiling "'mysql/mysql.h' file not found"

在include中,我甚至尝试了以下操作,以直接引用该文件:

In the include I have even tried the following, to reference the file directly:

#include = "/usr/local/mysql-5.7.9-osx10.9-x86_64/include/mysql.h"

无论我做什么,该消息始终为找不到'mysql/mysql.h'文件"

No matter what I try to do, the message is always "'mysql/mysql.h' file not found"

这是GCC C编译器脚本:

Here is the GCC C Compiler script:

Invoking: GCC C Compiler
gcc -I/usr/local/
-I/usr/local/mysql-5.7.9-osx10.9-x86_64/include
-I/usr/local/mysql-5.7.9-osx10.9-x86_64
-I/usr/local/mysql-5.7.9-osx10.9-x86_64
-I/usr/local/mysql-connector-c-6.1.6-osx10.8-x86_64/include 
-I/usr/local/mysql-connector-c-6.1.6-osx10.8-x86_64
-O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/TestConsole2.d"
-MT"src/TestConsole2.d" -o "src/TestConsole2.o" "../src/TestConsole2.c"

../src/TestConsole2.c:14:10: fatal error: 'mysql/mysql.h' file not found
#include <mysql/mysql.h>

mysql.h可以在我的系统上的/usr/local/mysql-5.7.9-osx10.9-x86_64/include/mysql.h中找到

The mysql.h can be found at /usr/local/mysql-5.7.9-osx10.9-x86_64/include/mysql.h on my system

仅需添加一条注释...我正在扩展Centos 6服务器上的当前c程序,我的意图是在Eclipse的Mac上构建模块,对其进行测试,然后将这些模块集成到服务器.

Just a note to add... I am extending a current c program that is on a Centos 6 server, my intentions are to build the modules on my Mac in Eclipse, test them, then integrate the modules into the program on the server.

谢谢

推荐答案

第一步是验证在哪里安装mysql 您可以使用命令

First step is to verify at where are install mysql you can using the commands

ls

有关目录的文件列表 并使用

for see the file list of directory and using

cd

在我的示例中,安装位于目录中:

in my example, the installation are in directory:

/usr/local/mysql-<version_my_mysql>/include/

第二步是指示每次编译器的目录:

second step is indicate the directory everytime compiller:

gcc my_program_code_file.c -I /usr/local/mysql-5.7.9-osx10.9-x86_64/include/ -o my_program_executable

在代码中,包含者为:

#include <mysql.h>

这篇关于找不到#include'mysql/mysql.h'文件-Eclipse/Mac OSX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆