How to fix “Compilation failed” error in smart contract deployment?

How to fix “Compilation failed” error in smart contract deployment?

PS D:\election> truffle migrate

PS D:\election> truffle migrate

Compiling .\contracts\Election.sol...

Compiling .\contracts\Migrations.sol...

Compilation warnings encountered:

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

/D/election/contracts/Election.sol:8: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). ,/D/election/contracts/Election.sol:8:5: Warning: This declaration shadows an existing declaration. function Election () public { ^ (Relevant source part starts here and spans across multiple lines). /D/election/contracts/Election.sol:3:1: The shadowed declaration is here: contract Election { ^ (Relevant source part starts here and spans across multiple lines).

Compilation failed. See above.

Truffle v5.0.3 (core: 5.0.3) Node v8.12.0

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Top Blockchain Application Development Company

Codezeros is a top **[Blockchain solution and service provider](https://www.codezeros.com/ "Blockchain solution and service provider")** company which reinvents business with Blockchain solutions. Our Blockchain development solutions fortify the...

Top 10 Best Blockchain Programming Language for Blockchain Programmer

We aim at equipping you with every necessary knowledge of the best programming languages for blockchain and you'll learn more 10 Best Blockchain Programming Language for Programmer: C++, Java, Python, Ruby, Solidity, Go, JavaScript...

Blockchain Certification Training - Blockchain Course - Intellipaat

Enroll for Blockchain certification course online. Best Blockchain Training created with IBM to learn blockchain technology, Cryptocurrency, Bitcoin & become Blockchain Developer.