My compiler says that the @openzeppelin contracts don't match the compiler!

I'm trying to create my first smart contract. It's for ERC721 and I'm using Visual Studios. I have run into the same problem while trying to use 2 different programs (I tried to change programs when one wouldn't work and all of the fixes I could find didn't help).

When using Truffle I enter the command "truffle compile" and get the message
Compiling your contracts...

Everything is up to date, there is nothing to compile.
but my files aren't compiled.

when I try to use Hardhat by entering "npx hardhat compile" I get

Error HH606: The project cannot be compiled, see reasons below.

The Solidity version pragma statement in these files don't match any of the configured compilers in your config. Change the pragma or configure additional compiler versions in your hardhat config.

  • contracts/sq639families.sol (^0.8.0)
  • @openzeppelin/contracts/utils/Counters.sol (^0.8.0)
  • @openzeppelin/contracts/token/ERC721/ERC721.sol (^0.8.0)
  • @openzeppelin/contracts/utils/introspection/ERC165.sol (^0.8.0)
  • @openzeppelin/contracts/utils/introspection/IERC165.sol (^0.8.0)
  • @openzeppelin/contracts/token/ERC721/IERC721.sol (^0.8.0)
  • @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol (^0.8.0)
  • @openzeppelin/contracts/utils/Strings.sol (^0.8.0)
  • @openzeppelin/contracts/utils/Context.sol (^0.8.0)
  • @openzeppelin/contracts/utils/Address.sol (^0.8.0)
  • @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol (^0.8.0)

I have checked that both my hardhat.config.js file and all of the referenced @openzepelin files have the solidity 0.8.0. I have no idea where to go from here. Please help.

Hi, welcome! :wave:

So did you set config? Did you specify the compiler version?
For truffle, you can have a look at this: Configuration - Truffle Suite

For hardhat, you can have a look at this: Configuration | Hardhat | Ethereum development environment for professionals by Nomic Labs

I have checked and made sure that the version I'm using is set in the config and the same on all of the files, they are all 0.8.11

I also tried having them all on the 0.8.0 but it didn't work any better

Please share your Hardhat config.