【问题标题】:missing type specifier - int assumed. Note c++ does not support default-int缺少类型说明符 - 假定为 int。注意 c++ 不支持 default-int
【发布时间】:2020-03-23 16:39:22
【问题描述】:

出现此错误以及指出变量“managers”、“stores”、“products”和inventory”未声明且缺少';'的错误在他们面前。

#include "Manager Info Structure.h"
#include "pch.h"
#include <iostream>
#include <string>
#include <fstream>
#include <array>

using namespace std;

//Vendor Variables
int VENDORSIZE = 3;
ManagerData managers[3];

这里列出了结构:

#pragma once
struct ManagerData
{
int     man_iD;
string  man_fname;
string  man_lname;
int     store_num;
int     exp_mon;
int     exp_year;
string  man_phone;
string  man_email;
};

编辑:删除了多余的信息,尝试将 pch.h 放在解决方案的顶部会导致 3 个在本文标题中列出的错误实例以及 'man_fname': unknown override specifier, 'man_lname': unknown覆盖说明符,“man_phone”:未知覆盖说明符,“man_email”:未知覆盖说明符。谢谢大家到目前为止的回答

【问题讨论】:

  • 如何缩小仅保留标题的问题,然后向我们展示剩下的所有内容?示例:由于问题出现在 3 种类型中:“经理”“产品”和“库存”我认为所有这些类型都存在相同的问题。你为什么不删除属于例如的标题产品和库存只为经理保留标题,在您的 cpp 中只保留 jeep ManagerData managers[3];
  • 共享的代码不足以找到问题的根本原因。头文件中可能有一些代码(未共享)会导致问题。

标签: c++ structure


【解决方案1】:

你很可能错过了一个 ;在定义上述结构之一之后。

【讨论】:

    猜你喜欢
    • 2017-03-28
    • 2022-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-02
    • 1970-01-01
    相关资源
    最近更新 更多