• MySQL知识库 :: c
  • Two header files have same definitions (e.g., 'typedef struct LIST LIST').

  • Discussion

    There may be a namespace clash, if your application uses certain names which are also used by MySQL. One example might be LIST, which is the name of an internal data structure used by MySQL to store various items. If you include the mysql.h header, you will have these names in your application's namespace.

    It's possible to work around this with something like the following:

    /* Avoid a namespace clash with package Foo's LIST */
    #define LIST MYSQL_LIST
    #include 
    #undef LIST

    This uses the C pre-processor to rename MySQL's data type. If you don't use it in your application anywhere, then the renaming will not affect anything else.