Dev C++ compilation error, permission denied

2019-02-22 10:25发布

I want to compile a code program using dev c++ compiler but my compiler didn't compile my code.The program consist of two files one is header and other is implementation .cpp file. The code i want to compile is correct and working,but it didn't compiling on my pc(windows 7) Please help

The error which i am getting is

  Permission denied 
  ld returned 1 exit status 
  C:\Makefile.win [Build Error]  [Project1.exe] Error 1 

here is my compile log

Compiler: Default compiler
Building Makefile: "C:\Makefile.win"
Executing  make...
make.exe -f "C:\Makefile.win" all
g++.exe -c testProgDoublyLinkedList.cpp -o testProgDoublyLinkedList.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"   

g++.exe testProgDoublyLinkedList.o  -o "Project1.exe" -L"C:/Dev-Cpp/lib" -mwindows  

C:\Dev-Cpp\Bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot open output file Project1.exe: Permission denied
collect2: ld returned 1 exit status

make.exe: *** [Project1.exe] Error 1

Execution terminated

7条回答
Evening l夕情丶
2楼-- · 2019-02-22 10:41

Windows 7

If you click save all files button then close and delete the makefile and others except the .cpp, .dev, .c then reopen using either .dev or .cpp or .c and then run it works.

查看更多
神经病院院长
3楼-- · 2019-02-22 10:39

C:\Dev-Cpp\Bin..\lib\gcc\mingw32\3.4.2........\mingw32\bin\ld.exe: cannot open output file Project1.exe: Permission denied collect2: ld returned 1 exit status

This line here is the computer saying it does not have permission to work with the specified directory. Either save your work in a new folder which the program has permission to work with or run your program as an administrator.

Kind of pointless responding to an old issue but if anyone else has this problem hopefully this will save them some time.

查看更多
何必那么认真
4楼-- · 2019-02-22 10:40

I tried all the proposed answers in my windows 7
1. run as administrator
2. Killed the process if it is running already
3. Gave full control permission to the project folder
4. Moved to different project folder.
Nothing solved my problem. finally i tried after disabling avast anti virus..it worked.

查看更多
疯言疯语
5楼-- · 2019-02-22 10:44

I removed generated exe file from projects folder and error went . I am removing after every rebuld-rerun . wait 1-2 minutes if it is not removing . one time try to remove , it will refuse . leave it and it will disappear itself . meanwhile you can enjoy changes in code . tried everything , only this worked

查看更多
女痞
6楼-- · 2019-02-22 10:50

Try running task manager to determine if your program is still running.

If it is terminate it because that's why your compiler is giving you an error.

查看更多
兄弟一词,经得起流年.
7楼-- · 2019-02-22 10:54

I was able to fix the same problem by creating a new folder and saving the project into that new folder. Then I also saved the source file within that same folder and everything finally executed correctly. It seemed to be a directory issue with finding the files when it was trying to execute.

查看更多
登录 后发表回答