TypeError: Data location must be “memory” for parameter in function, but none was given
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
add a comment |
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
add a comment |
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
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
solidity
asked Nov 24 '18 at 17:46
john mashano makumbijohn mashano makumbi
113
113
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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
add a comment |
//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;
}
}
add a comment |
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).
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
no errors its working.
– john mashano makumbi
Nov 24 '18 at 23:04
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
edited Dec 1 '18 at 21:22
Marcelo Fonseca
103111
103111
answered Nov 24 '18 at 20:58
k1ckk1ck
608214
608214
add a comment |
add a comment |
//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;
}
}
add a comment |
//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;
}
}
add a comment |
//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;
}
}
//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;
}
}
answered Jan 7 at 6:52
Kartik ganigaKartik ganiga
503
503
add a comment |
add a comment |
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).
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
no errors its working.
– john mashano makumbi
Nov 24 '18 at 23:04
add a comment |
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).
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
no errors its working.
– john mashano makumbi
Nov 24 '18 at 23:04
add a comment |
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).
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).
edited Nov 24 '18 at 23:10
answered Nov 24 '18 at 18:01
nikos fotiadisnikos fotiadis
7672514
7672514
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
no errors its working.
– john mashano makumbi
Nov 24 '18 at 23:04
add a comment |
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
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
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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