簡體   English   中英

警告:從不兼容的指針類型 [-Wincompatible-pointer-types] 傳遞“接受”的參數 2

[英]warning: passing argument 2 of ‘accept’ from incompatible pointer type [-Wincompatible-pointer-types]

我收到警告:從不兼容的指針類型 [-Wincompatible-pointer-types] 傳遞“接受”的參數 2

為什么我會收到此錯誤?

        if(s = accept(ls, &client_address, &client_address_len)<0);
        {
            perror("Error: accepting failed!!");
            exit(1);
        }

According to https://pubs.opengroup.org/onlinepubs/009695399/functions/accept.html , the second argument of accept function receives a type of struct sockaddr * . 您可能想要進行轉換: &client_address(struct sockaddr *)&client_address

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM