#7002: Error in opening the compiled module file

No, the compiler needs to get the right directories and I am not sure that F12 is equivalent to the options that the compiler gets. You will need to check the full commands and the build logs. As I am not overly familiar with VSCode I can only make very wild guesses.