gpt4 book ai didi

mysql - C MySQL API 编译器在包含头文件时重新定义时出现警告问题

转载 作者:行者123 更新时间:2023-11-29 09:10:12 26 4
gpt4 key购买 nike

我正在编译一个简单的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”以关闭此警告”。

这里可以看到头文件my_global.h

最佳答案

对于警告,定义 CYGWIN=nodosfilewarning在操作系统环境中(控制面板 -> 系统 -> 高级 -> 环境变量)。如果这不起作用,请尝试注销以确保没有任何东西在使用旧环境。

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

关于mysql - C MySQL API 编译器在包含头文件时重新定义时出现警告问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5804793/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com