【问题标题】:Solidity compiler throws DeclarationError in codeSolidity 编译器在代码中抛出 DeclarationError
【发布时间】:2018-05-13 10:49:05
【问题描述】:

我正在编写投票合同,并面临引用 DeclarationError: Identifier not found or not unique. Voter[] public voters; ^---^ 的一些声明错误 这是我下面的完整代码。我不确定我做错了什么。

contract Ballot {
int public majorityVotes;
Candidate[] public candidates;
mapping (address => uint) public voterId;
Voter[] public voters;

event CandidateAdded (uint candidateId, uint amount, string description);
event Voted (uint candidateId, int result, address voter);
event Tallyvotes (uint candidateId, int result, uint tally, bool active);

更多详细代码请访问here

我正在尝试为第一次过去的投票风格创建选票,但是编译失败。我希望有人可以通过并指出一些明显的错误。

【问题讨论】:

    标签: blockchain ethereum solidity


    【解决方案1】:

    错误说它无法找到数据类型 Voter,因为它没有定义。

    从您发布的 git 链接中,结构名称是 Vote 而不是 Voter。

    【讨论】:

      猜你喜欢
      • 2017-09-22
      • 1970-01-01
      • 2021-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-15
      • 2019-04-23
      • 1970-01-01
      相关资源
      最近更新 更多