Netbeans不承认sockaddr_in的成员 - C ++

时间:2013-08-03 19:50:55

标签: c++ ubuntu netbeans

Ubuntu上的My Netbeans安装无法识别结构sockaddr_in的任何成员。

代码:

#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>

// Later in the code

sockaddr_in serverAddress;
memset(&serverAddress, '0', sizeof(serverAddress));
serverAddress.sin_family = INADDR_ANY;
serverAddress.sin_port = htons(config.port);
serverAddress.sin_addr.s_addr = htonl(INADDR_ANY);

Netbeans在sin_family下显示红色卷曲线,sin_port和sin_addr表示Unable to resolve identifier sin_family。当我编译它(GCC)它工作得很好。

1 个答案:

答案 0 :(得分:1)

我修好了。右键点击Project Explorer,中的项目,转到Code Assistance,然后点击Reparse Project