Cyfrin / foundry-full-course-cu

GNU General Public License v3.0
2.88k stars 671 forks source link

@guyInTheChair Did you save the file? #372

Closed CodeTivity08 closed 11 months ago

CodeTivity08 commented 11 months ago

@guyInTheChair Did you save the file?

Originally posted by @alymurtazamemon in https://github.com/Cyfrin/foundry-full-course-f23/discussions/82#discussioncomment-6192167

Mine gave a different error message:

Error: 
Compiler run failed:
Error (7858): Expected pragma, import directive or contract/interface/library/struct/enum/constant/function/error definition.
  --> script/DeploySimpleStorage.s.sol:16:1:
   |
16 | }
   | ^

ChatGPT tells me this: "The error is caused by an incomplete import statement. It seems that the SimpleStorage contract is not being imported correctly.

Please make sure that the path to the SimpleStorage.sol file is correct. Double-check that the file is located in the correct directory relative to the DeploySimpleStorage.sol file.

Assuming that the SimpleStorage.sol file is in the ../src/ directory, you should update the import statement as follows:

solidity Copy code import {SimpleStorage} from "../src/SimpleStorage.sol"; Make sure the path is correct and try compiling the code again."

That was yesterday. Now I run the exact script (unchanged from yesterday) again, and it compiles successfully. This is the second time I had to quit the program and than continue the next day, and it suddenly works.

Any thoughts as to why?