Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

truffle compile error #42

Open
kaitojas opened this issue Aug 10, 2020 · 1 comment
Open

truffle compile error #42

kaitojas opened this issue Aug 10, 2020 · 1 comment

Comments

@kaitojas
Copy link

I got a compile error when i compile election.sol, it show's like this

/home/js/election/contracts/Election.sol:24:5: Warning: This declaration shadows an existing declaration.
function Election () public {
^ (Relevant source part starts here and spans across multiple lines).
/home/js/election/contracts/Election.sol:3:1: The shadowed declaration is here:
contract Election {
^ (Relevant source part starts here and spans across multiple lines).
,/home/js/election/contracts/Migrations.sol:11:3: Warning: This declaration shadows an existing declaration.
function Migrations() {
^ (Relevant source part starts here and spans across multiple lines).
/home/js/election/contracts/Migrations.sol:3:1: The shadowed declaration is here:
contract Migrations {
^ (Relevant source part starts here and spans across multiple lines).

/home/js/election/contracts/Election.sol:24:5: SyntaxError: Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use "constructor(...) { ... }" to define it.
function Election () public {
^ (Relevant source part starts here and spans across multiple lines).
,/home/js/election/contracts/Migrations.sol:11:3: SyntaxError: Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use "constructor(...) { ... }" to define it.
function Migrations() {
^ (Relevant source part starts here and spans across multiple lines).
,/home/js/election/contracts/Migrations.sol:11:3: SyntaxError: No visibility specified. Did you intend to add "public"?
function Migrations() {
^ (Relevant source part starts here and spans across multiple lines).
,/home/js/election/contracts/Migrations.sol:15:3: SyntaxError: No visibility specified. Did you intend to add "public"?
function setCompleted(uint completed) restricted {
^ (Relevant source part starts here and spans across multiple lines).
,/home/js/election/contracts/Migrations.sol:19:3: SyntaxError: No visibility specified. Did you intend to add "public"?
function upgrade(address new_address) restricted {
^ (Relevant source part starts here and spans across multiple lines).
,/home/js/election/contracts/Election.sol:29:28: TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given.
function addCandidate (string _name) private {
^----------^

@Maniddarky
Copy link

put function addCandidate (string memory _name) private {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants