ld.exe cannot open output file - c++11

i've used CodeBlocks for 8 months and now begins give me problems.
When I compile a file I happen to receive an error that is not given by the compilation itself, but from codeblock.
The error is:ld.exe cannot open output file Permission Denied.
Then I changed the folder thinking it was a problem with the fact that I do not have administrator access so I could not save in certain parts
Then I tried to rebuild and for a while it worked, and the error would not show up,
now she has returned as before because it keeps giving me the same error.Someone has already received this errorand he resolved?
Thanks :)

Your program is probably still running in background, or another process is using that file like anti-virus.
Check in task manager, if the program process is still running you get this message.

Related

Why am I getting intermittent DELETE PENDING errors in Dyalog APL?

I'm getting DELETE PENDING errors intermittently when my program deletes a file and then quickly thereafter creates a new file with the same path as the deleted file. In the Dyalog APL session window, it's reported as FILE ACCESS ERROR. I can re-create the error with Dyalog APL 16.0.35389.0 32 Classic on Windows Server 2012 R2 running on VMWare, but not on a bare-metal Windows 10 install. Here's a minimal code example that triggers the error:
:Namespace DeletePending
∇ main nTimes;filename;i
:For i :In ⍳nTimes
filename←'c:\tmp\delete_pending_dummy.txt'
(⊂'one' 'two')⎕NPUT filename 1
filename ⎕NERASE filename ⎕NTIE 0
:EndFor
∇
:EndNamespace
Attached is a screenshot showing the DELETE PENDING error in procmon (Sysinterals).
On my VMWare Windows install, I need to run at least 100 iterations of the loop in the main function (see the DeletePending namespace script above) to trigger the error. As far as I can tell, I'm using ⎕NPUT and ⎕NERASE correctly -- can someone tell me what's wrong?
What I've tried already (summary): creating and erasing a file in a loop, single thread; did not expect intermittent FILE ACCESS ERROR.
This seems to be a known issue C++/Win32: How to wait for a pending delete to complete. I am not sure there is much we (Dyalog) can do about it.

Raylib project stopped being able to run

Raylib project in visual studio was working perfectly fine, as in if you run the project it would execute and create a window and the game would run, but after opening the project one day, after attempting to run the project the same error kept appearing:
LNK1104 cannot open file '..\bin\Debug.DLL\ProjectName.exe'
I've tried rebuilding the project but the same error keeps appearing and I am not sure why.
Any Answers?
one thing that has worked for me in the past is transferring use into VScode instead of VSstudio, also a linker error is usually file related, check ether your program is already running or is loaded in the debugger(close it and run debug again) or your library paths are incorrect or aren't wrapped in double-quotes(depends on the path, may need < >). would be more clear if you included some code at least the uses of directives.

MS Visual Studio 2010 Error Message

I have spent all day trying to get a program working. Now, MS Studio 10 stopped compiling, with an error message,
fatal error LNK1168: cannot open K:\Continuing Education\CCCCD\COSC1436\Prog10\Debug\Prog10.exe for writing
I'm guessing this means it ran out of memory somewhere. What do I need to do to get it working, again?
Possible reasons:
You have an instance of Prog10.exe running
K: drive is full
If K:is a network drive, it went offline.
Make sure you have write permission to the mentioned directory. Is that where your project is stored?
The error message is telling you that it couldn't write out the exe file, which usually means there's something wrong with write permissions for that directory.

How to run a specified bat file at particular time ie.. scheduler

I have been using the at command to schedule the task
ex: at 14:45 my.bat
and i am getting the o/p on the command prompt as
"JOB ID is added"
But this command is not getting fired on the time which i have scheduled..
Can anyone please help me.......
I suspect the issue is not that the BAT file is not executing at all, but rather either or both of i) individual commands within the BAT file are failing, or ii) the output isn't getting sent to the place you're looking for it. (Things get even weirder if anything in the batch file requests input, since a) by default batch files may not be able to interact with the "console" at all and b) the system is probably unattended anyway at the time the batch file executes.) If my suspicion is right, there is no one "fix-everything" but rather a whole bunch of small fixes ...and you have to hit every one of them.
Find out the needed password to actually login as 'admin' (rather than your usual user), open a DOS box, and try to run the batch file. There should be some sort of error message that you can see. Fix that problem. Then try again ...and fix the next problem. Keep correcting problems and trying again until finally everything works.

"cannot open file" compiletime error

Problem Description:
Occassionally when debugging, I get the following error. I'm using visual studio 2010:
1>------ Build started: Project: projectName, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'C:\Projects\projectName\Debug\projectName.exe'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Note that projectName is the name of my project. The error occurs when I debug, make changes, and debug again (after doing all of that, the above error shows up instead of running the program a second time).
Steps to replicate:
Create a new empty c++ project, and add a file called "main.cpp" to the sources folder
Copy the following code into main.cpp:
int main(){
return 0;
}
Click the green debug arrow button, and note the successful run of the program. Ensure it is closed and that the debugging session is over. Open the process explorer and ensure the exe for the project is no longer running (if it is, wait until it closes).
Erase the contents of main.cpp and replace it with this code (or any other code that will compile properly which is different than the code used above):
#include<iostream>
int main(){
std::cout<<"hello\n";
return 0;
}
Click the green debug arrow button. Instead of running the program, the IDE will show the fatal LNK1104 error. You've now replicated the problem.
Any ideas on how to fix this?
Additional Details:
If I try to change the permissions or delete projectName.exe after the error has occured, an error popup shows up which says:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
I am using windows 7.
The account I'm using is an admin account, but this issue also occurs exactly the same when I use a non-admin account.
For 2-3 minutes after the error occurs, I cannot rebuild or debug the project, but after approximately that amount of time, I am able to start at the beginning of the repro steps again.
UPDATE: BOUNTY
Anyone who can offer a solution that fixes the problem gets 100 rep :)
I've tried stopping all services, processes and applications that could be interfering with VC++ accessing the file, and the issue is still occuring. Also, running vc++ as an admin does not help.
This is most likely a bugfeature of the Windows Explorer.
Make sure that the .exe file is NOT selected/focused in the Windows explorer. On Vista i often get LNK1104-errors, when the executable file is selected in the Windows Explorer during linking.
If that does not help, check that no other program has "selected" the file.
EDIT:
This program can show you which process has locked your file (the pages contains some links to other "unlock" tools aswell)
I had this problem with a new program I was writing that seemed to compile once but gave your error at the end of compilation and on subsequent builds. My Antiviral program, BitDefender, had locked the exe file. My exe was in the list of viruses found. I turned off Bitdefender for 5 minutes, recompiled and the program was not locked when Bitdefender restarted or thereafter.
You can use Process Explorer to see if any process has a handle open to that file, even if the executable itself isn't running. Go to Find -> Find Handle or DLL... and type in projectName.exe, and it will give you a list of all processes that have it open.
My guess would be that something has a lock on the file. For whatever reason, VS cannot open the file to write the output of compilation. As SnOrfus suggests, make sure some sort of profiling or testing tools aren't open. I would also try to wait a few seconds between finishing an execution of the program (debug or otherwise) before attempting to rebuild. It's possible that you're building so fast that the debugger still has a lock on the file when VS attempts to access it.
I've never seen that happen when there wasn't a lock on the file. Do you have any profiling or testing tools that might still be holding on to it?
note: I wasn't able to repro that.
edit> Have you tried opening process explorer while the program is running (as opposed to task manager)? It'll show you if your exe is running in any other processes.
Have you checked for malware? I recently had a case where some malware that would bootstrap every process that ran on a machine, and task manager wasn't very informative.

Resources