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

前端 未结 3 758
孤独总比滥情好
孤独总比滥情好 2021-01-14 12:35

This is what I get when trying to compile a simple hello world program with gcc.

c:\\>gcc hello.c
hello.c:9:2: warning: no newline at end of file
C:\\MinG         


        
3条回答
  •  误落风尘
    2021-01-14 13:19

    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.

提交回复
热议问题