【发布时间】:2015-09-28 22:32:50
【问题描述】:
我正在尝试编译一个使用 MySql 的 c 程序。我在 Ubuntu 14.04 上使用 Eclipse CDT,我已经从终端执行了 sudo apt-get install libmysqlclient-dev。在 Eclipse 中构建程序时,我得到了 ulong、uint 等的一系列“未知类型名称”
代码
#include <stdio.h>
#include <stdlib.h>
#include <mysql.h>
#include <my_global.h>
int main(void) {
puts("!!!Hello World!!!");
printf("MySQL client version: %s\n", mysql_get_client_info());
return EXIT_SUCCESS;
}
在项目/构建项目(或项目/清理)上,我得到:
08:20:26 **** Build of configuration Debug for project CTest1 ****
make all
Building file: ../src/CTest1.c
Invoking: GCC C Compiler
gcc -std=c99 -I/usr/include/mysql -O0 -g3 -Wall -lmysqlclient -MMD -MP -MF"src/CTest1.d" -MT"src/CTest1.d" -o "src/CTest1.o" "../src/CTest1.c"
In file included from ../src/CTest1.c:14:0:
/usr/include/mysql/my_global.h:971:1: error: unknown type name ‘ulong’
typedef ulong nesting_map; /* Used for flags of nesting constructs */
^
我错过了什么? BTW 编译并运行了一个不使用 mysql 的简单 c 程序。
【问题讨论】:
标签: mysql c ubuntu-14.04 eclipse-cdt