Solutions to the problem of “collect2.exe: error: LD returned 1” exit “status when writing C + + with vscode

VSCode writes C++ code, and an error is reported at runtime:
Undefined reference to ` WinMain ‘
Exe: Error: LD returned 1 exit status

Solution 1:
Check the code to see if there are any keyword misspellings.
Solution 2:
Close the collect2. Exe.
Win+R, Enter MSinfo32, Enter;
Software environment –& GT; Running tasks;
Find the corresponding process and view the “process ID”;
Win+R, Enter CMD, Enter;
Input: TSkill process ID.
Solution 3:
Ctrl+S, save. To run again.

Read More: