小编Ion*_*Ion的帖子

函数名前的预期初始化程序

#include <iostream>
#include <string>

using namespace std;

struct sotrudnik {
    string name;
    string speciality;
    string razread;
    int zarplata;
}

sotrudnik create(string n,string spec,string raz,int sal) {
    sotrudnik temp;
    temp.name=n;
    temp.speciality=spec;
    temp.razread=raz;
    temp.zarplata=sal;
    return temp;
}
*sotrudnik str_compare (string str1, string str2, sotrudnik sot1, sotrudnik sot2)
Run Code Online (Sandbox Code Playgroud)

我尝试学习C++.但是当我尝试使用选项"g ++ -Wall -c"使用GCC-4.4.5编译此代码时,我收到以下错误:

g ++ -Wall -c"lab2.cc"(在目录中:/ home/ion/Univer/Cpp)

lab2.cc:11:错误:create
lab2.cc:20 之前的预期初始化程序:错误:str_compare
编译失败前的预期构造函数,析构函数或类型转换.

这两个错误都与函数声明有关.(第11轮是函数创建的声明,第20轮 - 函数str_compare).试图谷歌这些类型的错误,但无法找到类似错误的例子,因为错误消息非常通用.我怎样才能理解它们的含义以及如何解决它们?非常感谢您的关注.

c++ gcc compilation

12
推荐指数
2
解决办法
8万
查看次数

标签 统计

c++ ×1

compilation ×1

gcc ×1