Compiling with GCC on windows 7: \\mingw32\\bin\\ld.exe: cannot open output file a.exe

对着背影说爱祢 提交于 2019-12-01 09:34:10

Yes it is a permissions issue, you must not be running the command line window in Admin mode.

Don't work in C:\

Copy the file to a folder under my documents, or a subfolder of C:, or another drive.

Or, run the console in Administrator mode if you really want to work in the root of C:

To switch to D: while in C:, just type D: (you use CD only when already on the correct drive)

alecov

The most common case is that your program may still be running in the background, possibly hanged on an endless loop. You can try searching for the process in the process list (press Alt+Ctrl+Del) and killing it.

Hubert

The g++.exe-command in the build-log in the CodeBlocks-IDE shows the command with an additional path: C:\MinGW\lib, which is wrong.

  1. If you copy the command to a cmd-window (in the directory of your Project) without the C:\MinGW\lib the compiler works. When you copy the command as shown in CodeBlocks-Buil-log it fails, with the same message in the cmd-window.

  2. Have a look at the Settings > Compiler > Search Directories > Linker. You've got to delete the C:\MinGW\lib there, but the bug is, that it is not deleted if you do it once. You've got to repeat it and then it works.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!