求问这是什么错误,,,C语言菜鸟表示看的一脸懵逼
Tofloor
poster avatar
doraemon
deepin
2018-05-18 00:18
Author
zhang@zhang-PC:~/Desktop/zhang$ ls
_mingw.h  time.h  zhal.c
zhang@zhang-PC:~/Desktop/zhang$ gcc zhal.c
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:132:0,
                 from /usr/include/stdlib.h:275,
                 from zhal.c:2:
/usr/include/time.h:39:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__MINGW_NOTHROW’
int __cdecl __MINGW_NOTHROW gettimeofday(struct timeval *__restrict__,
             ^~~~~~~~~~~~~~~
/usr/include/time.h:39:13: error: unknown type name ‘__MINGW_NOTHROW’
In file included from /usr/include/x86_64-linux-gnu/sys/select.h:47:0,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:219,
                 from /usr/include/stdlib.h:275,
                 from zhal.c:2:
/usr/include/x86_64-linux-gnu/bits/time.h:30:8: error: redefinition of ‘struct timeval’
struct timeval
        ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:132:0,
                 from /usr/include/stdlib.h:275,
                 from zhal.c:2:
/usr/include/time.h:11:8: note: originally defined here
struct timeval {
        ^~~~~~~
zhang@zhang-PC:~/Desktop/zhang$


Reply Favorite View the author
All Replies
avatar
linusboyle
deepin
2018-05-18 01:36
#1
为什么你的linux上会有mingw……
Reply View the author
avatar
ritter
deepin
2018-05-18 15:26
#2
int __cdecl __MINGW_NOTHROW gettimeofday();完全没看懂这个函数是什么意思,c语言还有这种神奇的语法?int+两个不知道什么鬼的东西+函数名(),这到底是什么语法?
或许int__cdecl__MINGW_NOTHROW中间没有空格,是一个typedef struct{}int __cdecl __MINGW_NOTHROW,那就说得通了。
Reply View the author
avatar
Lotuso
deepin
2018-05-18 16:42
#3
  1. sudo apt install build-essential gdb -y
Copy the Code
以上方式安装gcc编译环境


Reply View the author
avatar
duanyao
deepin
2018-05-18 23:00
#4
_mingw.h 和 time.h 不像是应该出现在你的目录下的文件,是怎么来的?
你应该贴出完整的 zhal.c 源码再求助。如果有保密要求,精简到能重现你的问题的程度再发。
Reply View the author
avatar
x1596357
deepin
2018-05-19 04:11
#5
用着mingw的头文件, 配着原生的gcc, 我不知道该怎么说...
Reply View the author
avatar
何来
deepin
2018-05-20 09:00
#6
duanyao 发表于 2018-5-18 15:00
_mingw.h 和 time.h 不像是应该出现在你的目录下的文件,是怎么来的?
你应该贴出完整的 zhal.c 源码再求助 ...

是这个理。
Reply View the author