7

I am new to solidity and I am running code on Remix. It doesn't matter what version of compiler I specify, I keep on getting the same error. Can someone help me out? What does "Compiler version ^0.8.0 does not satisfy the r semver requirement" exactly mean?

Here is my code:

// SPDX-License-Identifier: UNLICENSED

pragma solidity ^ 0.8.0;

contract Storage {

struct People {
    uint256 favoriteNumber;
    string name;
}

mapping(string => uint256) public nameToFavoriteNumber;
People[] public people;

function addPerson(uint _personFavoriteNumber, string memory _personName ) public {
    people.push(People({favoriteNumber: _personFavoriteNumber, name: _personName}));
    nameToFavoriteNumber[_personName] = _personFavoriteNumber;
}

} This is my screenshot

김예군
  • 169
  • 2
  • 7

2 Answers2

2

I had the same issue a couple of times. In Remix, I added a ".0" to the compiler version like so:

pragma solidity ^0.8.4.0;

I ran into this in Virtual Studio code also but I just ignored it and everything worked fine. I hope this helps!

1

It works in Remix as well, but I have worked on contracts that work without adding that ".0" at last, now even they show this error.

pragma solidity ^0.8.8.0;