我在Ubuntu上安装的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)时,它工作正常。

最佳答案

我修好了它。在Project Explorer,中的项目上单击鼠标右键,然后转到Code Assistance,然后单击Reparse Project

10-05 22:04