i am having troubles when i want to compile the sol file, specifically this error:

':20:16: TypeError: Member "push" not found or not visible after argument-dependent lookup in uint32[100] storage ref\n    uint32 a = people.push(12);\n               ^---------^\n'

pragma solidity ^0.4.18;

contract Voting {

 mapping (bytes32 => uint8) public votesReceived;
 uint32[100] public people;

 bytes32[] public candidateList;

 function Voting(bytes32[] candidateNames) public {
   candidateList = candidateNames;

 function onlyOneVote(uint32 ethaddress) returns(bool) {
   bool a = autentic(ethaddress);
   if (a == true) {


 function autentic(uint32 id) view public returns(bool) {
   for(uint i = 0; i< people.length; i++) {
     if(people[i] == id) {
       return (false);
     } else {

i'm using ganache for "the blockchain" thank you in advance

  • Please format you're code it's impossible to read/parse it unformatted – hextet May 16 '18 at 21:14
  • ok.. give me a sec to learn how to – bhalgalix May 16 '18 at 21:17
  • 1
    uint32 ethaddress should be address _ethAddress Several bad practices in the OG post. – Matt Swezey May 16 '18 at 21:34

Your problem comes from you trying to "push" an item onto the array whose length you have pre-defined. Instead of using push, use people[index_num] = 12 and you'll get the result you want. push would work if the array length wasn't pre-defined at compile time.

That aside, I would highly suggest you re-read the solidity documentation top-to-bottom and get a better understanding of the language. You're code looks very buggy, and shows a misunderstanding of how the language and the EVM work. All of this can lead to making disastrous errors that can lead to significant financial loss.

  • Thank you for your answer, just added a counter to the index_num and worked well. And 90% of the code is from a tutorial to do a simple voting app, i am still learning. it will help me learn if you tell me how will you do it better or less buggy or tell me why is very buggy. Again, thank you for your quick answer. – bhalgalix May 16 '18 at 21:40
  • http://solidity.readthedocs.io/en/v0.4.24/introduction-to-smart-contracts.html#index-6 http://solidity.readthedocs.io/en/v0.4.24/solidity-in-depth.html :) – hextet May 16 '18 at 21:44
  • Sorry for bothering again.. i read the articles but i still dont know why you say my code is buggy, can you tell me one part that you think that and how will you do it better. I am not asking for all the code, just 1 line or something like that – bhalgalix May 17 '18 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.