C MySQL API编译器警告问题,包括头文件时重新定义

时间:2011-04-27 13:21:19

标签: mysql c eclipse compiler-warnings

我正在编译一个简单的c程序来测试eclipse cygwin环境mysql-connector-c-6.0.2上的库文件的包含 该计划

#include <my_global.h>
#include <mysql.h>
int main(int argv,char* argc[])
{
        printf("my SQL libraries successfully included\n");
    return 0;
}

我将编译器错误视为

cygwin warning:
  MS-DOS style path detected: C:\MinGW\Workspace\sql_test\Debug
  Preferred POSIX equivalent is: /cygdrive/c/MinGW/Workspace/sql_test/Debug
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
In file included from ../sql_test.c:8:
D:\mysql-connector-c-6.0.2\include/my_global.h:1416:1: warning: "floatget" redefined
D:\mysql-connector-c-6.0.2\include/my_global.h:1232:1: warning: this is the location of the previous definition
D:\mysql-connector-c-6.0.2\include/my_global.h:1417:1: warning: "floatstore" redefined
D:\mysql-connector-c-6.0.2\include/my_global.h:1231:1: warning: this is the location of the previous definition
D:\mysql-connector-c-6.0.2\include/my_global.h:1418:1: warning: "doubleget" redefined
D:\mysql-connector-c-6.0.2\include/my_global.h:1220:1: warning: this is the location of the previous definition
D:\mysql-connector-c-6.0.2\include/my_global.h:1419:1: warning: "doublestore" redefined
D:\mysql-connector-c-6.0.2\include/my_global.h:1225:1: warning: this is the location of the previous definition
Finished building: ../sql_test.c

我已经验证了my_global.h文件,这些文件的减速似乎是有效的。

  1. 如何解决这些重新定义错误?
  2. 在eclipse中的位置以及如何设置此“CYGWIN环境变量选项”nodosfilewarning“以关闭此警告”。
  3. 您可以在此处看到

    的标题文件my_global.h

1 个答案:

答案 0 :(得分:2)

对于警告,请在OS环境中定义CYGWIN=nodosfilewarning(控制面板 - &gt; system - &gt; advanced - &gt;环境变量)。如果这不起作用,请尝试注销以确保没有使用旧环境。

对于重新定义的错误,正如Bo所说,编译器会告诉你错误的确切位置。如果您不理解它们,那么您至少应该将这些行作为问题的一部分发布。