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

This is what I get when I try 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:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot open output file a.exe
: Permission denied
collect2: ld returned 1 exit status

Is this related to Windows 7 administrative privileges?

If the output file is created but cannot be opened, where is it located?

Sorry if this is too big a noobie question. I am using Dev-C ++ to compile my source code so far. I tried to find the error, but all I could find was the file is already open, but there is no mention of this exe in the task manager.

Edit: also the file is located at C: \ hello.c

Can I do this if I put it on another drive?

When I put a file in D: \ and try to change it to any other drive using cd d: \, it does not change the drive.

+3
3

, , .

C:\

C: .

, C:

D: C:, D: ( CD , )

+6

, , , . ( Alt + Ctrl + Del) .

0

g++ exe CodeBlocks-IDE : C:\MinGW\lib, .

  • cmd- ( ) C:\MinGW\lib . , CodeBlocks-Buil-log, , CMD-.

  • Settings > Compiler > Search Directories > Linker. C:\MinGW\lib , , , . , .

-2

Source: https://habr.com/ru/post/1758979/


All Articles