编译失败内部编译器错误:堆栈太深,请尝试使用较少的变量

时间:2018-10-22 10:37:27

标签: blockchain solidity

我正在尝试编写波纹管合同,但出现错误。如果我删除映射,我不会收到错误消息: 使用默认编译器编译,坚固性版本:0.4.24 + commit.e67f0147.Emscripten.clang InternalCompilerError:堆栈太深,请尝试使用较少的变量。 合同:

 contract MasterContract{

struct Person
{

    uint Id;        
    string FirstName;
    string LastName;
    string FathersName;
    string HomeAdress;        
    string PhoneNumber;      
    string Username;
    string PersonalEmail;


}

mapping(uint => Person) public person;

uint public personsCount;

function addPerson( string _FirstName, string _LastName,  string _FathersName, string _HomeAdress,  string _PhoneNumber,  string _Username, string _PersonalEmail )
 private {
    personsCount ++;
    persons_fn[patientsCount]=Patient(patientsCount, _FirstName, _LastName, _FathersName, _HomeAdress,  _PhoneNumber, _Username, _PersonalEmail);
}


}

1 个答案:

答案 0 :(得分:1)

当我尝试编译它时,我没有看到您遇到的错误。但是,由于未声明,我不得不将[iahmad@ijaz00]$ kubectl api-resources --namespaced=true NAME SHORTNAMES APIGROUP NAMESPACED KIND bindings true Binding configmaps cm true ConfigMap endpoints ep true Endpoints events ev true Event limitranges limits true LimitRange persistentvolumeclaims pvc true PersistentVolumeClaim pods po true Pod podtemplates true PodTemplate replicationcontrollers rc true ReplicationController resourcequotas quota true ResourceQuota secrets true Secret serviceaccounts sa true ServiceAccount services svc true Service controllerrevisions apps true ControllerRevision daemonsets ds apps true DaemonSet deployments deploy apps true Deployment replicasets rs apps true ReplicaSet statefulsets sts apps true StatefulSet localsubjectaccessreviews authorization.k8s.io true LocalSubjectAccessReview horizontalpodautoscalers hpa autoscaling true HorizontalPodAutoscaler cronjobs cj batch true CronJob jobs batch true Job stacks compose.docker.com true Stack events ev events.k8s.io true Event daemonsets ds extensions true DaemonSet deployments deploy extensions true Deployment ingresses ing extensions true Ingress networkpolicies netpol extensions true NetworkPolicy replicasets rs extensions true ReplicaSet alertmanagers monitoring.coreos.com true Alertmanager prometheuses monitoring.coreos.com true Prometheus prometheusrules monitoring.coreos.com true PrometheusRule servicemonitors monitoring.coreos.com true ServiceMonitor networkpolicies netpol networking.k8s.io true NetworkPolicy poddisruptionbudgets pdb policy true PodDisruptionBudget rolebindings rbac.authorization.k8s.io true RoleBinding roles rbac.authorization.k8s.io true Role 更改为persons_fn,将person更改为patientsCount

我认为您刚刚进行了一些重构,却忘记了对其进行更改。

否则,代码将在personsCount的Remix中成功编译

这是固定代码:

0.4.24+commit.e67f0147.Emscripten.clang

如果您想了解有关Solidity和智能合约创建的更多信息,请查看我专门为此做的课程-Solidity Smart Contracts: Build Dapps In Ethereum Blockchain

以下是折扣券: QAUS8657