1

I'm doing a tutorial on blockgeeks and have been stuck for hours.

This is the error i get when trying to compile my project

Compiling your contracts...
===========================
> Compiling @openzeppelin\contracts\token\ERC721\ERC721.sol
> Compiling @openzeppelin\contracts\token\ERC721\IERC721.sol
> Compiling @openzeppelin\contracts\token\ERC721\IERC721Receiver.sol
> Compiling @openzeppelin\contracts\token\ERC721\extensions\IERC721Metadata.sol
> Compiling @openzeppelin\contracts\utils\Address.sol
> Compiling @openzeppelin\contracts\utils\Context.sol
> Compiling @openzeppelin\contracts\utils\Strings.sol
> Compiling @openzeppelin\contracts\utils\introspection\ERC165.sol
> Compiling @openzeppelin\contracts\utils\introspection\IERC165.sol
> Compiling .\contracts\Migrations.sol
> Compiling .\contracts\virus.sol

ParserError: Expected string literal (path), "*" or alias list.
 --> /C/Users/Admin/virus/contracts/virus.sol:2:8:
  |
2 | import '@openzeppelin\contracts\token\ERC721\ERC721.sol';
  |        ^^^^^^^^^^^^^^^^

Compilation failed. See above.

This is the code for my solidity file.


pragma solidity >=0.4.22 <0.9.0;

import ""@openzeppelin\contracts\token\ERC721\ERC721.sol";

contract Virus is ERC721 {
  constructor() public ERC721("CryptoVirus", "Virus") {

  }
}

Any help would be appreciated as I am driving myself crazy with this. I have uninstalled and reinstalled truffle and openzeppelin and still no joy.

Thanks

John Kent
  • 11
  • 2

1 Answers1

1

You have a typo in your import statememnt.

import ""@openzeppelin\contracts\token\ERC721\ERC721.sol";

opens with two quote signs "". Replace it to just one "

import "@openzeppelin\contracts\token\ERC721\ERC721.sol";
Petr Hejda
  • 40,554
  • 8
  • 72
  • 100
  • Sorry that was a silly mistake I managed to include just before I copied over. I've tried many times with the correct quotes and no joy. – John Kent May 22 '21 at 20:18