Beginners face this collect2.exe error in VS Code while learning programming. This error mostly occurs due to following following :

  1. Antivirus
  2. Program still running in background
  3. Compiler not installed correctly
  4. Code is not saved

Solutions for this are :

  1. Disable antivirus. If using Windows defender then turn off only real-time protection
  2. Save your program first.
  3. Reinstall compiler(recommend to watch and install from legit youtube video
  4. Open Task Manager by ctrl+Shift+tab. Go to details section or process section and find a program running by your code’s filename. Right click on it and click on End Task.
  5. Best solution. Use CodeBlocks!!!!

--

--