小编Lom*_*ard的帖子

#including <alsa/asoundlib.h>和<sys/time.h>会导致多个定义冲突

这是重现的最小C程序:

#include <alsa/asoundlib.h>
#include <sys/time.h>

int main( void )
{
}
Run Code Online (Sandbox Code Playgroud)

这将编译gcc -c -o timealsa.o timealsa.c,但如果您包含该-std=c99开关,则会出现重新定义错误:

In file included from /usr/include/sys/time.h:28:0,
                 from timealsa.c:3:
/usr/include/bits/time.h:30:8: error: redefinition of ‘struct timeval’
 struct timeval
        ^
In file included from /usr/include/alsa/asoundlib.h:49:0,
                 from timealsa.c:2:
/usr/include/alsa/global.h:138:8: note: originally defined here
 struct timeval {
        ^
Run Code Online (Sandbox Code Playgroud)

如何在仍然使用时解决此冲突-std=c99

x86 gcc compiler-errors c99 alsa

5
推荐指数
1
解决办法
854
查看次数

Rust 有 tee(2) 的绑定吗?

Rust 是否有tee(2)instd::io或其他绑定?如果没有绑定,我将如何在 Rust 程序中获得该功能?

linux io rust

3
推荐指数
1
解决办法
132
查看次数

标签 统计

alsa ×1

c99 ×1

compiler-errors ×1

gcc ×1

io ×1

linux ×1

rust ×1

x86 ×1