简体   繁体   English

OS X上的Eclipse CDT抱怨gcc内置函数:“函数'__builtin_bzero'无法解析”

[英]Eclipse CDT on OS X complaining about gcc built-in function: “Function '__builtin_bzero' could not be resolved”

I am working on some c++ network code in Eclipse CDT as a makefile project but eclipse is complaining about FD_ZERO . 我正在将Eclipse CDT中的某些c ++网络代码作为makefile项目工作,但是eclipse抱怨FD_ZERO Compiling is working fine. 编译正常。

Minimal example: 最小示例:

#include <arpa/inet.h>

void test()
{
    fd_set fds;
    FD_ZERO(&fds);
}

This shows up in as "Eclipse is Function '__builtin_bzero' could not be resolved " error. 这显示为“ Eclipse是Function '__builtin_bzero' could not be resolved ”错误。

This FD_ZERO is a macro defined in `sys/select.h' FD_ZERO是在sys / select.h中定义的宏。

sys/select.h:#define    FD_ZERO(p)  __DARWIN_FD_ZERO(p)

and in sys/_structs.h we can find __DARWIN_FD_ZERO to be defined as a call to a gcc built-in function. sys/_structs.h我们可以找到__DARWIN_FD_ZERO定义为对gcc内置函数的调用。

#define __DARWIN_FD_ZERO(p)     __builtin_bzero(p, sizeof(*(p)))

I have selected mac os x tool chain in CDT and not altered any other options. 我已在CDT中选择了Mac OS X工具链,并且未更改任何其他选项。 Any ideas to solve this issue? 有解决这个问题的想法吗?

I noticed this hasn't been answered yet, so for completeness, this is my solution: 我注意到还没有答案,因此为了完整起见,这是我的解决方案:

Use memset(&fds, 0, sizeof fds); 使用memset(&fds, 0, sizeof fds); instead. 代替。

The problem is simply that __builtin_bzero is just that, it's builtin at the compiler level. 问题很简单,__ builtin_bzero就是这样,它是在编译器级别内置的。 CDT doesn't know that because it has its own parser. CDT不知道这一点,因为它有自己的解析器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM