youmir ali
youmir ali

Reputation: 71

Dev C++ compilation error, permission denied

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

Upvotes: 7

Views: 88969

Answers (7)

Mamuka Arabuli
Mamuka Arabuli

Reputation: 74

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

Upvotes: 0

Ember Freak
Ember Freak

Reputation: 12872

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.

Upvotes: 1

ThatGuy
ThatGuy

Reputation: 1

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.

Upvotes: 0

John
John

Reputation: 61

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.

Upvotes: 6

Help
Help

Reputation: 1

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.

Upvotes: 0

Alistair
Alistair

Reputation: 11

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.

Upvotes: 0

Jon
Jon

Reputation: 437376

Windows 7 does not let you write directly to the root of c:\ (among other locations) unless from within a process running with administrator privileges.

The simplest workaround for you is to move your project from c:\ to another directory -- for example, c:\projects will work.

Upvotes: 4

Related Questions