What can I do if a message is displayed indicating that collect2.exe cannot be opened when I run the C program

daisho0906 注册会员
2023-02-27 23:40
< div class = "md_content_show e397 data - v - 3967" = "" >

welcome to

dingning00 注册会员
2023-02-27 23:40

This error says that the output file cannot be opened, possibly because the file is occupied by another process or does not have enough permissions.

Regarding the file being occupied, you can try to shut down other processes that may be using the file. For example, the last run of the program may not have closed completely and caused the file to be occupied. You can also try restarting your computer to make sure no other processes are occupying the file.

On the question of permissions, even if you are using an administrator account, some operations need to be run with administrator permissions to be successful. You can try to delete a file or folder by right-clicking on it and selecting the "Run as administrator" option. If you still can't delete the file, you can try using the command line window to run the delete command as an administrator.

Also, problems with file naming can be caused by not setting the output file name correctly at compile time. You can check the output Settings of the compiler or manually specify the output file name to resolve the problem.

dudula2193 注册会员
2023-02-27 23:40
< div class = "md_content_show e397 data - v - 3967" = "" >

thank you!

csy19920701 注册会员
2023-02-27 23:40

This error message indicates that the linker could not open the output file "Cprimerplus_0212.exe" for write operations because the operating system did not grant the appropriate access rights to your account.

Possible cause:

Insufficient permissions: Even if you are an administrator, you need to check the permissions of the folder to make sure that you have permission to write to the file.

Virus or malware: Malware may lock files and prevent you from making changes or deleting them. It is recommended that you use anti-virus software to scan your computer for malware.


file is occupied by another process: another process may have opened the file and locked it. Make sure you close all applications or processes that use this file.

Try the following solution:

Check the folder's permission Settings to make sure you have sufficient permissions to write to the file.

Use anti-virus software to scan the computer for the presence of malware.

Close all applications or processes that use the file and attempt to delete the file.

If none of the above methods solve the problem, you can try booting the computer in safe mode and try deleting the files.

Hope you found these solutions helpful.