Qt Creator 報假定爲int類型

最近在qt寫網絡通訊,定義了一個協議的頭文件,引用之後發現報錯如下:

缺少類型說明符 - 假定爲 int。注意: C++ 不支持默認 int

“{”: 缺少函數標題(是否是老式的形式表?)

排查再三,沒有相互包含,沒有語法錯誤,最後發現結構體上邊不能加註釋,神坑!!!

下面是報錯代碼:

//網絡連接信息結構體
typedef struct test
{
    char server_ip[64];
    int  port;            
    char user_name[13];	
    char pass_word[13];	

}My_test;

修改後代碼:


typedef struct test
{
    //網絡連接信息結構體
    char server_ip[64];
    int  port;            
    char user_name[13];	
    char pass_word[13];	

}My_test;

完美解決。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章