令牌之前的预期初始值设定项'*'

expected initializer before '*' token

本文关键字:令牌      更新时间:2023-10-16

我正在尝试创建一个控制台应用程序,该应用程序在我正在使用的网络书籍的帮助下利用套接字和 ncurses。在编译时,我收到错误"该行的"*"标记之前的预期初始值设定项:

WINDOW* create_newwin(int height, int width, int starty, int startx);

在我包含一些我忘记包含的新标头(主要是网络标头(之前,我没有收到此错误。

错误前的标题

#include <ncurses.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <string.h>

错误开始抛出时我添加的标头

#include <stdio.h>      //for printf() and fprintf()
#include <sys/socket.h> //for socket(), connect(), send(), and recv()
#include <arpa/inet.h>  //for sockaddr_in and inet_addr()
#include <unistd.h>     //for close()
#include <iostream>
#include "DakchatHeader.hpp"

我知道这是标题,因为当我将它们注释掉时,特定的错误就会消失(但会出现有关未知函数等的错误(。

还应该注意的是,当我调用它时,它说的是未知函数,并且 WINDOW 是在 ncurses 中定义的。

谢谢你能给我的所有帮助!

在我的DakchatHeader.hpp文件中,我忘记在创建结构后添加一个semicolin。修复后,错误不再显示。