'Error trailing semicolon in smart contract on solidity?

I am trying to write a smart contract and line 1 is bringing up an error : ParserError: Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon. --> contracts/Mycontract.sol:1:1: | 1 | pragma solidity ^.0.8.1; |

I already have a semi colon in the contract what am I missing here? I am attemping this on the browser in Remix.



Solution 1:[1]

The correct format for first line for importing pragma shall be like

pragma solidity ^0.5.2;

Solution 2:[2]

You have a syntax error.

The correct format is ^0.8.1 (no dot after the caret ^).

Solution 3:[3]

pragma solidity ^0.8.1;

It should be like the given form above.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sumit Patel
Solution 2 Petr Hejda
Solution 3 β.εηοιτ.βε