TypeError: Data location must be “memory” for parameter in function, but none was given












2















pragma solidity ^0.5.0;



contract memeRegistry {



string url;
string name;
uint timestamp;

function setmeme(string _url,string _name, uint _timestamp) public{
url = _url;
name = _name;
timestamp = _timestamp;

}


}










share|improve this question



























    2















    pragma solidity ^0.5.0;



    contract memeRegistry {



    string url;
    string name;
    uint timestamp;

    function setmeme(string _url,string _name, uint _timestamp) public{
    url = _url;
    name = _name;
    timestamp = _timestamp;

    }


    }










    share|improve this question

























      2












      2








      2


      1






      pragma solidity ^0.5.0;



      contract memeRegistry {



      string url;
      string name;
      uint timestamp;

      function setmeme(string _url,string _name, uint _timestamp) public{
      url = _url;
      name = _name;
      timestamp = _timestamp;

      }


      }










      share|improve this question














      pragma solidity ^0.5.0;



      contract memeRegistry {



      string url;
      string name;
      uint timestamp;

      function setmeme(string _url,string _name, uint _timestamp) public{
      url = _url;
      name = _name;
      timestamp = _timestamp;

      }


      }







      solidity






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 17:46









      john mashano makumbijohn mashano makumbi

      113




      113
























          3 Answers
          3






          active

          oldest

          votes


















          4














          Explicit data location for all variables of struct, array or mapping types is now mandatory. This is also applied to function parameters and return variables.



          Add memory after string



          function setmeme(string memory _url, string memory _name, uint _timestamp) public{


          check here for Solidity 0.5.0. changes https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html






          share|improve this answer

































            2














            //The version I have used is 0.5.2

            pragma solidity ^0.5.2;

            contract Inbox{


            string public message;

            //**Constructor** must be defined using “constructor” keyword

            //**In version 0.5.0 or above** it is **mandatory to use “memory” keyword** so as to
            //**explicitly mention the data location**

            //you are free to remove the keyword and try for yourself

            constructor (string memory initialMessage) public{
            message=initialMessage;
            }

            function setMessage(string memory newMessage)public{
            message=newMessage;

            }

            function getMessage()public view returns(string memory){
            return message;
            }
            }





            share|improve this answer































              0














              Select a different version of the solidity compiler. ^0.4.25 works for me.



              The version of the solidity compiler has to be set both on the file and in the compile tab on remix(it is a drop-down menu).






              share|improve this answer


























              • if i use a different compiler its giving me a SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+

                – john mashano makumbi
                Nov 24 '18 at 18:16













              • You have to change the compiler version both on the file and also from remix. It is a drop-down menu on the compile tab. I have selected this: 0.4.25+commit.59dbf8f1 and it had no problem with your code.

                – nikos fotiadis
                Nov 24 '18 at 18:29











              • changed both on the file and compiler and its now working.

                – john mashano makumbi
                Nov 24 '18 at 18:57











              • You mean you are still getting compile errors?

                – nikos fotiadis
                Nov 24 '18 at 20:08











              • no errors its working.

                – john mashano makumbi
                Nov 24 '18 at 23:04











              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460851%2ftypeerror-data-location-must-be-memory-for-parameter-in-function-but-none-wa%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              4














              Explicit data location for all variables of struct, array or mapping types is now mandatory. This is also applied to function parameters and return variables.



              Add memory after string



              function setmeme(string memory _url, string memory _name, uint _timestamp) public{


              check here for Solidity 0.5.0. changes https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html






              share|improve this answer






























                4














                Explicit data location for all variables of struct, array or mapping types is now mandatory. This is also applied to function parameters and return variables.



                Add memory after string



                function setmeme(string memory _url, string memory _name, uint _timestamp) public{


                check here for Solidity 0.5.0. changes https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html






                share|improve this answer




























                  4












                  4








                  4







                  Explicit data location for all variables of struct, array or mapping types is now mandatory. This is also applied to function parameters and return variables.



                  Add memory after string



                  function setmeme(string memory _url, string memory _name, uint _timestamp) public{


                  check here for Solidity 0.5.0. changes https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html






                  share|improve this answer















                  Explicit data location for all variables of struct, array or mapping types is now mandatory. This is also applied to function parameters and return variables.



                  Add memory after string



                  function setmeme(string memory _url, string memory _name, uint _timestamp) public{


                  check here for Solidity 0.5.0. changes https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Dec 1 '18 at 21:22









                  Marcelo Fonseca

                  598




                  598










                  answered Nov 24 '18 at 20:58









                  EgorEgor

                  524112




                  524112

























                      2














                      //The version I have used is 0.5.2

                      pragma solidity ^0.5.2;

                      contract Inbox{


                      string public message;

                      //**Constructor** must be defined using “constructor” keyword

                      //**In version 0.5.0 or above** it is **mandatory to use “memory” keyword** so as to
                      //**explicitly mention the data location**

                      //you are free to remove the keyword and try for yourself

                      constructor (string memory initialMessage) public{
                      message=initialMessage;
                      }

                      function setMessage(string memory newMessage)public{
                      message=newMessage;

                      }

                      function getMessage()public view returns(string memory){
                      return message;
                      }
                      }





                      share|improve this answer




























                        2














                        //The version I have used is 0.5.2

                        pragma solidity ^0.5.2;

                        contract Inbox{


                        string public message;

                        //**Constructor** must be defined using “constructor” keyword

                        //**In version 0.5.0 or above** it is **mandatory to use “memory” keyword** so as to
                        //**explicitly mention the data location**

                        //you are free to remove the keyword and try for yourself

                        constructor (string memory initialMessage) public{
                        message=initialMessage;
                        }

                        function setMessage(string memory newMessage)public{
                        message=newMessage;

                        }

                        function getMessage()public view returns(string memory){
                        return message;
                        }
                        }





                        share|improve this answer


























                          2












                          2








                          2







                          //The version I have used is 0.5.2

                          pragma solidity ^0.5.2;

                          contract Inbox{


                          string public message;

                          //**Constructor** must be defined using “constructor” keyword

                          //**In version 0.5.0 or above** it is **mandatory to use “memory” keyword** so as to
                          //**explicitly mention the data location**

                          //you are free to remove the keyword and try for yourself

                          constructor (string memory initialMessage) public{
                          message=initialMessage;
                          }

                          function setMessage(string memory newMessage)public{
                          message=newMessage;

                          }

                          function getMessage()public view returns(string memory){
                          return message;
                          }
                          }





                          share|improve this answer













                          //The version I have used is 0.5.2

                          pragma solidity ^0.5.2;

                          contract Inbox{


                          string public message;

                          //**Constructor** must be defined using “constructor” keyword

                          //**In version 0.5.0 or above** it is **mandatory to use “memory” keyword** so as to
                          //**explicitly mention the data location**

                          //you are free to remove the keyword and try for yourself

                          constructor (string memory initialMessage) public{
                          message=initialMessage;
                          }

                          function setMessage(string memory newMessage)public{
                          message=newMessage;

                          }

                          function getMessage()public view returns(string memory){
                          return message;
                          }
                          }






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 7 at 6:52









                          Kartik ganigaKartik ganiga

                          383




                          383























                              0














                              Select a different version of the solidity compiler. ^0.4.25 works for me.



                              The version of the solidity compiler has to be set both on the file and in the compile tab on remix(it is a drop-down menu).






                              share|improve this answer


























                              • if i use a different compiler its giving me a SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+

                                – john mashano makumbi
                                Nov 24 '18 at 18:16













                              • You have to change the compiler version both on the file and also from remix. It is a drop-down menu on the compile tab. I have selected this: 0.4.25+commit.59dbf8f1 and it had no problem with your code.

                                – nikos fotiadis
                                Nov 24 '18 at 18:29











                              • changed both on the file and compiler and its now working.

                                – john mashano makumbi
                                Nov 24 '18 at 18:57











                              • You mean you are still getting compile errors?

                                – nikos fotiadis
                                Nov 24 '18 at 20:08











                              • no errors its working.

                                – john mashano makumbi
                                Nov 24 '18 at 23:04
















                              0














                              Select a different version of the solidity compiler. ^0.4.25 works for me.



                              The version of the solidity compiler has to be set both on the file and in the compile tab on remix(it is a drop-down menu).






                              share|improve this answer


























                              • if i use a different compiler its giving me a SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+

                                – john mashano makumbi
                                Nov 24 '18 at 18:16













                              • You have to change the compiler version both on the file and also from remix. It is a drop-down menu on the compile tab. I have selected this: 0.4.25+commit.59dbf8f1 and it had no problem with your code.

                                – nikos fotiadis
                                Nov 24 '18 at 18:29











                              • changed both on the file and compiler and its now working.

                                – john mashano makumbi
                                Nov 24 '18 at 18:57











                              • You mean you are still getting compile errors?

                                – nikos fotiadis
                                Nov 24 '18 at 20:08











                              • no errors its working.

                                – john mashano makumbi
                                Nov 24 '18 at 23:04














                              0












                              0








                              0







                              Select a different version of the solidity compiler. ^0.4.25 works for me.



                              The version of the solidity compiler has to be set both on the file and in the compile tab on remix(it is a drop-down menu).






                              share|improve this answer















                              Select a different version of the solidity compiler. ^0.4.25 works for me.



                              The version of the solidity compiler has to be set both on the file and in the compile tab on remix(it is a drop-down menu).







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Nov 24 '18 at 23:10

























                              answered Nov 24 '18 at 18:01









                              nikos fotiadisnikos fotiadis

                              6171514




                              6171514













                              • if i use a different compiler its giving me a SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+

                                – john mashano makumbi
                                Nov 24 '18 at 18:16













                              • You have to change the compiler version both on the file and also from remix. It is a drop-down menu on the compile tab. I have selected this: 0.4.25+commit.59dbf8f1 and it had no problem with your code.

                                – nikos fotiadis
                                Nov 24 '18 at 18:29











                              • changed both on the file and compiler and its now working.

                                – john mashano makumbi
                                Nov 24 '18 at 18:57











                              • You mean you are still getting compile errors?

                                – nikos fotiadis
                                Nov 24 '18 at 20:08











                              • no errors its working.

                                – john mashano makumbi
                                Nov 24 '18 at 23:04



















                              • if i use a different compiler its giving me a SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+

                                – john mashano makumbi
                                Nov 24 '18 at 18:16













                              • You have to change the compiler version both on the file and also from remix. It is a drop-down menu on the compile tab. I have selected this: 0.4.25+commit.59dbf8f1 and it had no problem with your code.

                                – nikos fotiadis
                                Nov 24 '18 at 18:29











                              • changed both on the file and compiler and its now working.

                                – john mashano makumbi
                                Nov 24 '18 at 18:57











                              • You mean you are still getting compile errors?

                                – nikos fotiadis
                                Nov 24 '18 at 20:08











                              • no errors its working.

                                – john mashano makumbi
                                Nov 24 '18 at 23:04

















                              if i use a different compiler its giving me a SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+

                              – john mashano makumbi
                              Nov 24 '18 at 18:16







                              if i use a different compiler its giving me a SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+

                              – john mashano makumbi
                              Nov 24 '18 at 18:16















                              You have to change the compiler version both on the file and also from remix. It is a drop-down menu on the compile tab. I have selected this: 0.4.25+commit.59dbf8f1 and it had no problem with your code.

                              – nikos fotiadis
                              Nov 24 '18 at 18:29





                              You have to change the compiler version both on the file and also from remix. It is a drop-down menu on the compile tab. I have selected this: 0.4.25+commit.59dbf8f1 and it had no problem with your code.

                              – nikos fotiadis
                              Nov 24 '18 at 18:29













                              changed both on the file and compiler and its now working.

                              – john mashano makumbi
                              Nov 24 '18 at 18:57





                              changed both on the file and compiler and its now working.

                              – john mashano makumbi
                              Nov 24 '18 at 18:57













                              You mean you are still getting compile errors?

                              – nikos fotiadis
                              Nov 24 '18 at 20:08





                              You mean you are still getting compile errors?

                              – nikos fotiadis
                              Nov 24 '18 at 20:08













                              no errors its working.

                              – john mashano makumbi
                              Nov 24 '18 at 23:04





                              no errors its working.

                              – john mashano makumbi
                              Nov 24 '18 at 23:04


















                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460851%2ftypeerror-data-location-must-be-memory-for-parameter-in-function-but-none-wa%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                              Calculate evaluation metrics using cross_val_predict sklearn

                              Insert data from modal to MySQL (multiple modal on website)