Tag: 重新定义

新到C,错误C2371:’错误’:重新定义;不同的基本类型

我要在几个小时内提交这个分配,我非常紧张,这是加油站管理程序,处理输入文件和打印结果…它只有1 .c文件,这是我的第一个代码行,它定义了结构 #include #include #include struct Gas_Station *pgasStationHead = NULL; typedef struct Gas_Station { char *name; double octan95SS; double octan95FS; double octan98SS; double octan98FS; double gasSoldTotal; double gasSoldSS; double gasSoldFS; struct Gas_Station* pgasStationNext; struct Client_List* pclientHead; } Station; typedef struct Client_List { char carID[10]; char gasType[3]; double gasAmount; char serviceType[12]; struct Client_List* pclientNext; } Client; […]

使用Visual Studio 2015 Win64编译MySQL连接器

在使用cmake创建解决方案后,我在构建期间在Visual Studio中面对1400个错误。 主要问题是,似乎没有人编译连接器,只是将预编译库用于他们的项目,在Windows上更是如此。 以下是一些错误,似乎timespec再次被重新定义,首先是在my_global.h中,然后是第二次,错误和定义。 所以问题是,我该如何修复1400错误? 或者至少,一些建议如何摆脱重新定义将是伟大的! time.h #ifndef _CRT_NO_TIME_T struct timespec {time_t tv_sec; //秒 – > = 0长tv_nsec; //纳秒 – [0,999999999]}; #endif my_global.h struct timespec { union ft64 tv; /* The max timeout value in millisecond for native_cond_timedwait */ long max_timeout_msec; }; 错误C2011’timespec’:’struct’类型重定义(编译源文件C:\ Users \ DDubinin \ Downloads \ mysql-connector-c-6.1.6-src \ mysys \ my_mess.c)mysys c:\ […]

全局变量与局部变量的重新声明

当我编译下面的代码时 #include int main() { int a; int a = 10; printf(“a is %d \n”,a); return 0; } 我收到一个错误: test3.c: In function ‘main’: test3.c:6:5: error: redeclaration of ‘a’ with no linkage test3.c:5:5: note: previous declaration of ‘a’ was here 但是,如果我将变量设为全局,那么它可以正常工作。 #include int a; int a = 10; int main() { printf(“a is %d \n”,a); return […]