Search code examples
mysqlcubuntu-14.04eclipse-cdt

Eclipse CDT MySql unknown type name ‘ulong’


I am trying to compile a c program that uses MySql. I am using Eclipse CDT on Ubuntu 14.04, I have executed sudo apt-get install libmysqlclient-dev from a terminal. When building the program in eclipse I get a series of "unknown type name" for ulong, uint, etc

Code

#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;
}

On project/build project (or project/clean) I get:

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 */

^

What am I missing? BTW compiled and ran a simple c program that did not use mysql.


Solution

  • Set ...

    #include <my_global.h>
    ...
    

    ...as the very first include.