Suddenly, my Visual Studio Express 2010 C++ stopped rebuilding my project.
When I first hit F7 the project builds and runs fine (heck, it’s a hello world example).
Then I make some changes and hit F7 again, then I get:
1>LINK : fatal error LNK1168: cannot open C:UsersusernameDocumentsVisual Studio 2010ProjectsconsoleDebugconsole.exe for writing**<br><br>
Now the funny thing comes:
- The app is not running and it’s not shown in the Task Manager.
- Going into the project directory and trying to remove it with hands comes with success but the file APPEARS AGAIN FROM NOWHERE.
- The system restore is disabled.
- I also tried to take the ownership of the whole damn drive.
- Every time I delete the file it recreates itself again but sometimes it stops doing that.
- If I delete the file (and it recreates after that), and then I start sysinternals procmon then the file disappears.
- If I start procmon before — then the file keeps appearing after delete like always.
OS: W7 SP1 64-bit, with latest updates
Any ideas, please?
Amal K
4,0642 gold badges18 silver badges43 bronze badges
asked Aug 25, 2012 at 17:25
1
The problem is probably that you forgot to close the program and that you instead have the program running in the background.
Find the console window where the exe file program is running, and close it by clicking the X in the upper right corner. Then try to recompile the program. In my case this solved the problem.
I know this posting is old, but I am answering for the other people like me who find this through the search engines.
answered Jul 6, 2013 at 6:53
7
I’ve encountered this problem when the build is abruptly closed before it is loaded. No process would show up in the Task Manager, but if you navigate to the executable generated in the project folder and try to delete it, Windows claims that the application is in use. (If not, just delete the file and rebuild, which generates a new executable)
In Windows(Visual Studio 2019), the file is located in this directory by default:
%USERPROFILE%sourcereposProjectFolderNameDebug
To end the allegedly running process, open the command prompt and type in the following command:
taskkill /F /IM ApplicationName.exe
This forces any running instance to be terminated.
Rebuild and execute!
answered Sep 17, 2019 at 16:20
Amal KAmal K
4,0642 gold badges18 silver badges43 bronze badges
1
Restarting Visual Studio solved the problem for me.
answered Jan 7, 2017 at 18:15
Aleksei MialkinAleksei Mialkin
2,1271 gold badge26 silver badges25 bronze badges
1
In my case, cleaning and rebuilding the project resolved the problem.
Uli Köhler
12.8k15 gold badges68 silver badges117 bronze badges
answered Mar 2, 2014 at 15:35
Hau LeHau Le
1211 silver badge5 bronze badges
If the above solutions didn’t work, you can try this which worked for me.
Open an elevated command prompt (cmd -> Run as administrator
), then write following command and hit enter:
wmic process where name='YOUR_PROCESS_NAME.exe' delete
If you see a message: Instance deletion successful.
, then you will be again able to build and run project from VS.
e.g. in OP’s case, the command will be:
wmic process where name='console.exe' delete
answered Aug 3, 2021 at 9:06
UkFLSUIUkFLSUI
5,4016 gold badges34 silver badges47 bronze badges
well, I actually just saved and closed the project and restarted VS Express 2013 in windows 8 and that sorted my problem.
answered Apr 8, 2015 at 17:50
2
The Reason is that your previous build is still running in the background.
I solve this problem by following these steps:
- Open Task Manager
- Goto Details Tab
- Find Your Application
- End Task it by right clicking on it
- Done!
answered Aug 4, 2020 at 12:48
back2Lobbyback2Lobby
4836 silver badges12 bronze badges
This solved same problem I also came across very well
- Close the app if it is still running on the taskbar,
- Open cmd (command prompt) and run the following
taskkill /F /IM ApplicationName.exe
- Rebuild your project!! error solved!
answered Sep 25, 2022 at 1:11
niosnios
611 silver badge7 bronze badges
This can also be a problem from the improper use of functions like FindNextFile when a FindClose is never executed. The process of the built file is terminated, and the build itself can be deleted, but LNK1168 will prevent a rebuild because of the open handle. This can create a handle leak in Explorer which can be addressed by terminating and restarting Explorer, but in many cases an immediate reboot is necessary.
answered Oct 9, 2015 at 2:44
Laurie StearnLaurie Stearn
9431 gold badge12 silver badges33 bronze badges
I know this is an old question but thought I’d share how I resolved the issue.
If you’re using Visual Studio and this error occurs, you can try to attach to process (CTRL+ALT+P) and find the «(program).exe» process. When you try to attach to it, an error will display stating that it failed to attach which removes the process from «running» (even though it’s not…) You’ll also be able to delete the (program).exe from your Debug folder.
Hope this helps someone!
answered Oct 4, 2019 at 5:25
tw1tch01tw1tch01
491 silver badge4 bronze badges
FINALLY THE BEST WAY WORKED PERFECTLY FOR ME
None of the solutions in this page worked for me EXCEPT THE FOLLOWING
Below the comment sections of the second answer, try the following :
Adding to my above comment, Task Manager does not display the
filename.exe process but Resource Monitor does, so I’m able to
kill it from there which solves the issue without having to reboot. –
A__ Jun 19 ’19 at 21:23
answered Aug 14, 2020 at 14:32
SamSam
2523 silver badges10 bronze badges
If none of the above suggested work for you, which was the case for me, just change the project name. It creates a new exe in the new project name. Later when you restart, you can change it back to your original project name.
answered Aug 22, 2021 at 9:43
RathnavelRathnavel
751 silver badge12 bronze badges
I know this is an old thread but I was stumbling in the same problem also. Finding it in task manager is tricky, and I started to grow tired of having to restart my PC every time this happened.
A solution would be to download Process Explorer and there you can search for running tasks. In my case I was having the following error:
1>LINK : fatal error LNK1168: cannot open C:OutBuildVS12_appDebugplatform_test.exe for writing [C:BuildVS12_appplatform_test.vcxproj]
I searched for C:OutBuildVS12_appDebugplatform_test.exe
in Process Explorer, killed it and I was able to compile.
answered Sep 15, 2022 at 11:15
Ra’wRa’w
1132 silver badges10 bronze badges
I also had this same issue. My console window was no longer open, but I was able to see my application running by going to processes within task manager. The process name was the name of my application. Once I ended the process I was able to build and compile my code with no issues.
answered Sep 12, 2013 at 23:54
JasonJason
1471 gold badge2 silver badges11 bronze badges
Start your program as an administrator. The program can’t rewrite your files cause your files are in a protected location on your hard drive.
answered Jan 6, 2014 at 15:07
0
Suddenly, my Visual Studio Express 2010 C++ stopped rebuilding my project.
When I first hit F7 the project builds and runs fine (heck, it’s a hello world example).
Then I make some changes and hit F7 again, then I get:
1>LINK : fatal error LNK1168: cannot open C:UsersusernameDocumentsVisual Studio 2010ProjectsconsoleDebugconsole.exe for writing**<br><br>
Now the funny thing comes:
- The app is not running and it’s not shown in the Task Manager.
- Going into the project directory and trying to remove it with hands comes with success but the file APPEARS AGAIN FROM NOWHERE.
- The system restore is disabled.
- I also tried to take the ownership of the whole damn drive.
- Every time I delete the file it recreates itself again but sometimes it stops doing that.
- If I delete the file (and it recreates after that), and then I start sysinternals procmon then the file disappears.
- If I start procmon before — then the file keeps appearing after delete like always.
OS: W7 SP1 64-bit, with latest updates
Any ideas, please?
Amal K
4,0642 gold badges18 silver badges43 bronze badges
asked Aug 25, 2012 at 17:25
1
The problem is probably that you forgot to close the program and that you instead have the program running in the background.
Find the console window where the exe file program is running, and close it by clicking the X in the upper right corner. Then try to recompile the program. In my case this solved the problem.
I know this posting is old, but I am answering for the other people like me who find this through the search engines.
answered Jul 6, 2013 at 6:53
7
I’ve encountered this problem when the build is abruptly closed before it is loaded. No process would show up in the Task Manager, but if you navigate to the executable generated in the project folder and try to delete it, Windows claims that the application is in use. (If not, just delete the file and rebuild, which generates a new executable)
In Windows(Visual Studio 2019), the file is located in this directory by default:
%USERPROFILE%sourcereposProjectFolderNameDebug
To end the allegedly running process, open the command prompt and type in the following command:
taskkill /F /IM ApplicationName.exe
This forces any running instance to be terminated.
Rebuild and execute!
answered Sep 17, 2019 at 16:20
Amal KAmal K
4,0642 gold badges18 silver badges43 bronze badges
1
Restarting Visual Studio solved the problem for me.
answered Jan 7, 2017 at 18:15
Aleksei MialkinAleksei Mialkin
2,1271 gold badge26 silver badges25 bronze badges
1
In my case, cleaning and rebuilding the project resolved the problem.
Uli Köhler
12.8k15 gold badges68 silver badges117 bronze badges
answered Mar 2, 2014 at 15:35
Hau LeHau Le
1211 silver badge5 bronze badges
If the above solutions didn’t work, you can try this which worked for me.
Open an elevated command prompt (cmd -> Run as administrator
), then write following command and hit enter:
wmic process where name='YOUR_PROCESS_NAME.exe' delete
If you see a message: Instance deletion successful.
, then you will be again able to build and run project from VS.
e.g. in OP’s case, the command will be:
wmic process where name='console.exe' delete
answered Aug 3, 2021 at 9:06
UkFLSUIUkFLSUI
5,4016 gold badges34 silver badges47 bronze badges
well, I actually just saved and closed the project and restarted VS Express 2013 in windows 8 and that sorted my problem.
answered Apr 8, 2015 at 17:50
2
The Reason is that your previous build is still running in the background.
I solve this problem by following these steps:
- Open Task Manager
- Goto Details Tab
- Find Your Application
- End Task it by right clicking on it
- Done!
answered Aug 4, 2020 at 12:48
back2Lobbyback2Lobby
4836 silver badges12 bronze badges
This solved same problem I also came across very well
- Close the app if it is still running on the taskbar,
- Open cmd (command prompt) and run the following
taskkill /F /IM ApplicationName.exe
- Rebuild your project!! error solved!
answered Sep 25, 2022 at 1:11
niosnios
611 silver badge7 bronze badges
This can also be a problem from the improper use of functions like FindNextFile when a FindClose is never executed. The process of the built file is terminated, and the build itself can be deleted, but LNK1168 will prevent a rebuild because of the open handle. This can create a handle leak in Explorer which can be addressed by terminating and restarting Explorer, but in many cases an immediate reboot is necessary.
answered Oct 9, 2015 at 2:44
Laurie StearnLaurie Stearn
9431 gold badge12 silver badges33 bronze badges
I know this is an old question but thought I’d share how I resolved the issue.
If you’re using Visual Studio and this error occurs, you can try to attach to process (CTRL+ALT+P) and find the «(program).exe» process. When you try to attach to it, an error will display stating that it failed to attach which removes the process from «running» (even though it’s not…) You’ll also be able to delete the (program).exe from your Debug folder.
Hope this helps someone!
answered Oct 4, 2019 at 5:25
tw1tch01tw1tch01
491 silver badge4 bronze badges
FINALLY THE BEST WAY WORKED PERFECTLY FOR ME
None of the solutions in this page worked for me EXCEPT THE FOLLOWING
Below the comment sections of the second answer, try the following :
Adding to my above comment, Task Manager does not display the
filename.exe process but Resource Monitor does, so I’m able to
kill it from there which solves the issue without having to reboot. –
A__ Jun 19 ’19 at 21:23
answered Aug 14, 2020 at 14:32
SamSam
2523 silver badges10 bronze badges
If none of the above suggested work for you, which was the case for me, just change the project name. It creates a new exe in the new project name. Later when you restart, you can change it back to your original project name.
answered Aug 22, 2021 at 9:43
RathnavelRathnavel
751 silver badge12 bronze badges
I know this is an old thread but I was stumbling in the same problem also. Finding it in task manager is tricky, and I started to grow tired of having to restart my PC every time this happened.
A solution would be to download Process Explorer and there you can search for running tasks. In my case I was having the following error:
1>LINK : fatal error LNK1168: cannot open C:OutBuildVS12_appDebugplatform_test.exe for writing [C:BuildVS12_appplatform_test.vcxproj]
I searched for C:OutBuildVS12_appDebugplatform_test.exe
in Process Explorer, killed it and I was able to compile.
answered Sep 15, 2022 at 11:15
Ra’wRa’w
1132 silver badges10 bronze badges
I also had this same issue. My console window was no longer open, but I was able to see my application running by going to processes within task manager. The process name was the name of my application. Once I ended the process I was able to build and compile my code with no issues.
answered Sep 12, 2013 at 23:54
JasonJason
1471 gold badge2 silver badges11 bronze badges
Start your program as an administrator. The program can’t rewrite your files cause your files are in a protected location on your hard drive.
answered Jan 6, 2014 at 15:07
0
I get the following error using vs2017
Severity Code Description Project File Line Suppression State
Error LNK1168 cannot open c:usersownerdocumentsvisual studio 2017ProjectsDebugWin32Project1.exe for writing Win32Project1 c:UsersOwnerdocumentsvisual studio 2017ProjectsWin32Project1LINK 1
37 minutes ago, phil67rpg said:
cannot open filename.exe for writing
(I deleted the path and changed the filename for simpler reading.) Looks like you’re trying to edit an EXE file.
— Tom Sloper — Sloperama Productions — Making games fun and getting them done — www.sloperama.com
20 minutes ago, Tom Sloper said:
Looks like you’re trying to edit an EXE file.
how do I fix this problem?
Don’t try to edit an EXE file. You should be editing source code, not object code.
— Tom Sloper — Sloperama Productions — Making games fun and getting them done — www.sloperama.com
6 minutes ago, phil67rpg said:
how do I fix this problem?
Most likely you didn’t close the last run of your program and the compiler can’t write the new version out. Check your taskbar. Maybe check task manager also.
.
5 hours ago, phil67rpg said:
I get the following error using vs2017
Severity Code Description Project File Line Suppression State
Error LNK1168 cannot open c:usersownerdocumentsvisual studio 2017ProjectsDebugWin32Project1.exe for writing Win32Project1 c:UsersOwnerdocumentsvisual studio 2017ProjectsWin32Project1LINK 1
Usually this means you have your program running at the same time you are tying to compile it. The system knows the .exe file is in use so it’s telling you you have to close the program before doing the compile so it can write a new version of the exe. Also I’ve seen it before that even if your program is no longer running, the system gets confused and thinks the exe is still in use. If all else fails, reboot your system.
Funnily, Linux lets you change an executable that is currently running (at least on ext-filesystems). The change doesn’t affect the file in memory, just next time it is started the new version will be loaded.
The «problem» might be file system/os dependent, or a built-in functionality in visual studio. Is there a logical reason not to change executables on disk that are currently running ? Updates for example depend on that …
3 minutes ago, Green_Baron said:
Funnily, Linux lets you change an executable that is currently running (at least on ext-filesystems). The change doesn’t affect the file in memory, just next time it is started the new version will be loaded.
The «problem» might be file system/os dependent, or a built-in functionality in visual studio. Is there a logical reason not to change executables on disk that are currently running ? Updates for example depend on that …
I vaguely remember that the exe is, or at least was used to swap in code and/or constant data when memory was tight. Don’t quote me on this however.
Yeah … there was something like that …
Or another process (anti-virus thing ?) has its thumb on it ?
Anyway:
https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk1168?view=vs-2019
I frequently discover one or two windows from earlier debug runs that were hiding behind the ide window when i close it …
2 minutes ago, Green_Baron said:
I frequently discover one or two windows from earlier debug runs that were hiding behind the ide window when i close it … ?
Ha, ha, Same here ?
description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid |
---|---|---|---|---|---|
Learn more about: Linker Tools Error LNK1168 |
Linker Tools Error LNK1168 |
11/04/2016 |
LNK1168 |
LNK1168 |
97ead151-fd99-46fe-9a1d-7e84dc0b8cc8 |
cannot open filename for writing
The linker can’t write to filename
. The file may be in use and its file handle locked by another process, or you may not have write permission for the file, or for the directory or network share it is located in. This error is often caused by a transient condition—for example, a lock held by an anti-virus program, a file search indexing process, or a delay in releasing a lock held by the Visual Studio build system.
To fix this issue, verify that the filename
file handle is not locked, and that you have write permission for the file. If it is an executable, verify that it is not already running.
You can use the Windows SysInternals utilities Handle or Process Explorer to determine which process has a file handle lock on filename
. You can also use Process Explorer to release locks on open file handles. For information about how to use these utilities, see the Help files that come with them.
If the file is locked by an anti-virus program, you can fix this issue by excluding your build output directories from automatic scanning by the anti-virus program. Anti-virus scanners are often triggered by the creation of new files in the file system, and they hold locks on the files while the scan proceeds. Consult your anti-virus program documentation for details about how to exclude specific directories from scanning.
If the file is locked by a search indexing service, you can fix this issue by excluding your build output directories from automatic indexing. Consult the documentation for the indexing service for more information. To change the Windows search indexing service, use Indexing Options in the Windows Control Panel. For more information, see Search indexing in Windows 10: FAQ.
If your executable can’t be overwritten by the build process, it may be locked by File Explorer. If the Application Experience service has been disabled, File Explorer may hold on to an executable file handle lock for an extended time. To fix this issue, run services.msc and then open the Properties dialog box for the Application Experience service. Change the Startup type from Disabled to Manual.
Содержание
- Ошибка средств компоновщика LNK1168
- Linker Tools Error LNK1168
- Fatal error lnk1168 visual
- Лучший отвечающий
- Вопрос
- Ответы
- Все ответы
- Fatal error lnk1168 visual
- Answered by:
- Question
- Answers
- All replies
- Fatal error lnk1168 visual
- Лучший отвечающий
- Вопрос
- Ответы
- Все ответы
Ошибка средств компоновщика LNK1168
не удается открыть «имяфайла» для записи
Компоновщику не удается выполнить запись в filename . Файл используется или его дескриптор заблокирован другим процессом либо у вас нет разрешения на запись для этого файла, каталога или сетевой папки, в которой находится файл. Эта ошибка часто вызвана временным условием, например блокировкой, удерживаемой антивирусной программой, процессом индексирования файлов или задержкой при освобождении блокировки, удерживаемой системой сборки Visual Studio.
Чтобы устранить эту проблему, убедитесь, что дескриптор файла filename не заблокирован и у вас есть разрешение на запись в данный файл. Если это исполняемый файл, убедитесь, что он не запущен на исполнение.
Вы можете использовать обработчик служебных программ Windows SysInternals или обозреватель процессов , чтобы определить, какой процесс имеет блокировку filename дескриптора файлов. С помощью программы Process Explorer можно также снимать блокировку дескрипторов открытых файлов. Сведения об использовании этих программ см. в поставляемых с ними файлах справки.
Если файл заблокирован антивирусной программой, для устранения проблемы исключите выходные каталоги сборки из автоматической проверки антивирусной программой. Программы проверки на вирусы часто запускаются при создании в системе новых файлов и блокируют эти файлы на время проверки. Сведения о порядке отключения проверки определенных каталогов см. в документации антивирусной программы.
Если файл заблокирован службой индексирования поиска, для устранения этой проблемы отключите автоматическое индексирование выходных каталогов сборки. Дополнительные сведения см. в документации службы индексирования. Чтобы изменить службу индексирования поиска Windows, используйте параметры индексирования в Windows панель управления. Дополнительные сведения см. в разделе «Поиск индексирования» в Windows 10: вопросы и ответы.
Источник
cannot open filename for writing
The linker can’t write to filename . The file may be in use and its file handle locked by another process, or you may not have write permission for the file, or for the directory or network share it is located in. This error is often caused by a transient condition—for example, a lock held by an anti-virus program, a file search indexing process, or a delay in releasing a lock held by the Visual Studio build system.
To fix this issue, verify that the filename file handle is not locked, and that you have write permission for the file. If it is an executable, verify that it is not already running.
You can use the Windows SysInternals utilities Handle or Process Explorer to determine which process has a file handle lock on filename . You can also use Process Explorer to release locks on open file handles. For information about how to use these utilities, see the Help files that come with them.
If the file is locked by an anti-virus program, you can fix this issue by excluding your build output directories from automatic scanning by the anti-virus program. Anti-virus scanners are often triggered by the creation of new files in the file system, and they hold locks on the files while the scan proceeds. Consult your anti-virus program documentation for details about how to exclude specific directories from scanning.
If the file is locked by a search indexing service, you can fix this issue by excluding your build output directories from automatic indexing. Consult the documentation for the indexing service for more information. To change the Windows search indexing service, use Indexing Options in the Windows Control Panel. For more information, see Search indexing in Windows 10: FAQ.
Источник
Fatal error lnk1168 visual
Лучший отвечающий
Вопрос
Подскажите пожалуйста. Пишу исходник в Microsoft Visual C++ 2008 Express Edition. Компилирую — все нормально, работает. вношу какие либо изменения в коде и пытаюсь заново скомпилировать. Выдает вот такую ошибку.
1>—— Построение начато: проект: 5_stepen’, Конфигурация: Debug Win32 ——
1>Компиляция.
1>stepen’.cpp
1>Компоновка.
1>LINK : fatal error LNK1168: не удается открыть C:UsersAntonDocumentsVisual Studio 2008Projects5_stepen’Debug5_stepen’.exe для записи
1>Журнал построения был сохранен в «file://c:UsersAntonDocumentsVisual Studio 2008Projects5_stepen’5_stepen’DebugBuildLog.htm»
1>5_stepen’ — ошибок 1, предупреждений 0
========== Построение: успешно: 0, с ошибками: 1, без изменений: 0, пропущено: 0 ==========
Для устранения приходится сохранить мой.cpp и закрыть прогу. через 2 минуты отрывать. тогда запускается компиляция. Ни чего не могу поделать.
Ответы
Такое происходит, когда Ваш файл 5_stepen.exe не доступен для записи. В ОС WinNT это ситуация возникает, когда файл залочен. Причиной может служить следующее: Вы скомпилировали проект и запустили полученный код. Вносите изменения, компилируете, но запись в файл .exe линковщиком не может быть выполнена, т.к. программа продолжает выполняться, т.е. она продолжает висеть в памяти. Для решения проблемы необходимо просто остановить выполнение Вашей программы 5_stepen.exe.
Все ответы
Такое происходит, когда Ваш файл 5_stepen.exe не доступен для записи. В ОС WinNT это ситуация возникает, когда файл залочен. Причиной может служить следующее: Вы скомпилировали проект и запустили полученный код. Вносите изменения, компилируете, но запись в файл .exe линковщиком не может быть выполнена, т.к. программа продолжает выполняться, т.е. она продолжает висеть в памяти. Для решения проблемы необходимо просто остановить выполнение Вашей программы 5_stepen.exe.
Здравствуйте, я использую Visual Studio 2008 Pro (C++). Недавно появилась такая проблема: при построении проекта построение «останавливается» на компановке и дальше ни в какую. Студия закрывается только экстренным завершением через диспетчер задач. При этом после закрытия остается процесс link.exe, который:
1) нельзя «убить» (пробовал стандартным диспетчером задач Win XP, Far менеджером);
2) использует файлы компилированного проекта (BuildLog.htm, main.obj, Program.exe в папке Debug) таким образом их нельзя удалить или изменить (при перезапуске визуалки проект не компилируется);
3) не может завершиться при попытке выхода из пользователя/ухода в спящий режим/выключения/перезагрузки, т.е. комп выключается только через ресет.
При этом если после перезапуска визуалки компилировать другой проект получается (с ним может возникнуть аналогичный косяк и будет уже два «висячих» процесса).
Попробовал переставить визуалку — помогло, но не надолго (2-3 дня данной ошибки не было).
Не подскажите, как избавиться от косяка (или хотя бы «убить» процесс без перезагрузки). Заранее спасибо.
Источник
Fatal error lnk1168 visual
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
When I first compile and link a solution, everything works fine. However, often (about 60 — 70% of the time), subsequent link operations fail unable to open the .exe file for writing. I’ve checked the obvious things such as the application still running and even trying to delete the existing file via explorer fails saying the file is in use.
If I wait long enough — sometimes up to 5 minutes — then all works well again. I haven’t worked out when this happens. It usually happens if I encounter an unhandled exception during a test run, but sometimes I get this even when the test run was clean.
Answers
How have you the checked that the application is still running? Have you used the Tak Manager?
Thanks to both Simple Samples and einaros.
Yes — I checked task manager but the app wasn’t running.
I suspect that my AV (Norton) might be involved so I’ll download the utility you mention and give it a go. I’ll keep you posted.
look for filename.exe in process.
and finish the filename.exe.
1>LINK : fatal error LNK1168: cannot open C:yadadamyapp.exe for writing
Typically happens after I run the program from Visual Studio, then close the program. The process shuts down and does not show up in either the process manager, or from the commmand line using the ‘handle application. I get this error around 75% of the time.
Here is what I have tried:
- The application ‘myapp.exe’ has closed down cleanly I think. It is not on the process list in the Windows Task Manager
- Sysinternal’s program ‘Handle’ doesn’t find any matching handles for ‘myapp.exe’
- The freeware program ‘Unlocker 1.9.0’ doesn’t think the file is locked
- I can manually delete the file
To get around this error, I have to:
- Manually delete the file through Windows Explorer, or
- Wait a few minutes, then try building again.
Any solution?
On Tue, 20 Jul 2010 02:26:34 +0100, wrote:
>
> Stars: 1; Post: 13;
>
>
> Sorry to ressurect an old thread, but I have this exact same problem on
> Windows 7 64-bit with Visual Studio 2010. The linker fails with the
> error: 1>LINK : fatal error LNK1168: cannot open C:yadadamyapp.exe for
> writing Typically happens after I run the program from Visual Studio,
> then close the program. The process shuts down and does not show up in
> either the process manager, or from the commmand line using the ‘handle
> application. I get this error around 75% of the time. Here is what I
> have tried: The application ‘myapp.exe’ has closed down cleanly I think.
> It is not on the process list in the Windows Task Manager Sysinternal’s
> program ‘Handle’ doesn’t find any matching handles for ‘myapp.exe’ The
> freeware program ‘Unlocker 1.9.0’ doesn’t think the file is locked I can
> manually delete the file To get around this error, I have to: Manually
> delete the file through Windows Explorer, or Wait a few minutes, then
> try building again. Any solution?
Try adding an exception to your anti-virus software.
—
Using Opera’s revolutionary e-mail client: http://www.opera.com/mail/
I disabled the antivirus, I’m using Norton Security Suite. The problem has not gone away. I also have problems with the Windows 7 filesystem not always updating the explorer window after file operations. I suspect this is related.
Frustrating. i need to go back to Windows XP i think, this is my work machine.
Anyone have similar problems?
I am using TortoiseSVN and Elaborate Bytes Virtual CD-ROM Drive that might be causing the problem.
- I changed the «DontRefresh» key from 1 to 0 in HKEY_CLASSES_ROOTCLSID\Instance.
- Uninstalled Virtual CD-ROM Drive
Hopefully this will solve the problem, will post results.
Источник
Fatal error lnk1168 visual
Лучший отвечающий
Вопрос
When I first compile and link a solution, everything works fine. However, often (about 60 — 70% of the time), subsequent link operations fail unable to open the .exe file for writing. I’ve checked the obvious things such as the application still running and even trying to delete the existing file via explorer fails saying the file is in use.
If I wait long enough — sometimes up to 5 minutes — then all works well again. I haven’t worked out when this happens. It usually happens if I encounter an unhandled exception during a test run, but sometimes I get this even when the test run was clean.
Ответы
Все ответы
How have you the checked that the application is still running? Have you used the Tak Manager?
Thanks to both Simple Samples and einaros.
Yes — I checked task manager but the app wasn’t running.
I suspect that my AV (Norton) might be involved so I’ll download the utility you mention and give it a go. I’ll keep you posted.
look for filename.exe in process.
and finish the filename.exe.
1>LINK : fatal error LNK1168: cannot open C:yadadamyapp.exe for writing
Typically happens after I run the program from Visual Studio, then close the program. The process shuts down and does not show up in either the process manager, or from the commmand line using the ‘handle application. I get this error around 75% of the time.
Here is what I have tried:
- The application ‘myapp.exe’ has closed down cleanly I think. It is not on the process list in the Windows Task Manager
- Sysinternal’s program ‘Handle’ doesn’t find any matching handles for ‘myapp.exe’
- The freeware program ‘Unlocker 1.9.0’ doesn’t think the file is locked
- I can manually delete the file
To get around this error, I have to:
- Manually delete the file through Windows Explorer, or
- Wait a few minutes, then try building again.
Any solution?
On Tue, 20 Jul 2010 02:26:34 +0100, wrote:
>
> Stars: 1; Post: 13;
>
>
> Sorry to ressurect an old thread, but I have this exact same problem on
> Windows 7 64-bit with Visual Studio 2010. The linker fails with the
> error: 1>LINK : fatal error LNK1168: cannot open C:yadadamyapp.exe for
> writing Typically happens after I run the program from Visual Studio,
> then close the program. The process shuts down and does not show up in
> either the process manager, or from the commmand line using the ‘handle
> application. I get this error around 75% of the time. Here is what I
> have tried: The application ‘myapp.exe’ has closed down cleanly I think.
> It is not on the process list in the Windows Task Manager Sysinternal’s
> program ‘Handle’ doesn’t find any matching handles for ‘myapp.exe’ The
> freeware program ‘Unlocker 1.9.0’ doesn’t think the file is locked I can
> manually delete the file To get around this error, I have to: Manually
> delete the file through Windows Explorer, or Wait a few minutes, then
> try building again. Any solution?
Try adding an exception to your anti-virus software.
—
Using Opera’s revolutionary e-mail client: http://www.opera.com/mail/
I disabled the antivirus, I’m using Norton Security Suite. The problem has not gone away. I also have problems with the Windows 7 filesystem not always updating the explorer window after file operations. I suspect this is related.
Frustrating. i need to go back to Windows XP i think, this is my work machine.
Anyone have similar problems?
I am using TortoiseSVN and Elaborate Bytes Virtual CD-ROM Drive that might be causing the problem.
- I changed the «DontRefresh» key from 1 to 0 in HKEY_CLASSES_ROOTCLSID\Instance.
- Uninstalled Virtual CD-ROM Drive
Hopefully this will solve the problem, will post results.
Источник
VC++ фатальная ошибка LNK1168: не удается открыть имя файла.exe для написания
внезапно моя visual studio express 2010 c++ перестала перестраивать мой проект.
Когда я впервые попал в F7, проект строится и работает нормально (черт, это пример hello world).
Затем я делаю некоторые изменения и снова нажимаю F7, затем я получаю:
1>Ссылка: фатальная ошибка LNK1168: не удается открыть C:UsersusernameDocumentsVisual Studio 2010проектыконсольотладкаконсоль.exe для написания
Теперь приходит забавная вещь:
- приложение не запущено и это не показано в диспетчере задач.
- зайдя в каталог проекта и пытаясь удалить его руками приходит с успехом, но файл появляется снова из ниоткуда o_O
- восстановление системы отключено
- я также пытался взять на себя ответственность за весь чертов диск
- каждый раз, когда я удаляю файл, он воссоздает себя снова, но иногда он перестает это делать
- если удалить файл (и он воссоздается после этого), а затем я запустите Sysinternals procmon, затем файл исчезнет.
- если я начну procmon до — то файл продолжает появляться после удаления, как всегда
OS: W7 SP1 64-бит, с последними обновлениями
есть идеи, пожалуйста? google мне не помог: (
8 ответов
включить службу «опыт работы с приложениями». Запустите окно консоли и введите net start AeLookupSvc
проблема наверное в том, что вы забыли закрыть программу и вместо вас программа работает в фоновом режиме.
найдите окно консоли, в котором запущена программа exe-файла, и закройте его, щелкнув X в правом верхнем углу. Затем попробуйте перекомпилировать программу. В моем случае это решило проблему.
Я знаю, что это сообщение старое, но я отвечаю за других людей, таких как я, которые находят это через поисковые системы.
Регистрация на форуме тут, о проблемах пишите сюда — alarforum@yandex.ru, проверяйте папку спам! Обязательно пройдите восстановить пароль
Поиск по форуму |
Расширенный поиск |
fatal error LNK1168 — Не могу понять почему появляется такая ошибка. У меня Visual Studio 2008. Только чтото поменяю в коде как выскакивает такой бред. Что мне с етим лишним EXE делать ? Спасибо.
P.S. : Вся ошибка выглядит так : LINK : fatal error LNK1168: не удается открыть E:Documents and SettingsOlegМои документыVisual Studio 2008ProjectsWin32-пробаDebugДомашня з Win32 №4(2).exe для записи
Интенсив по Python: Работа с API и фреймворками 24-26 ИЮНЯ 2022. Знаете Python, но хотите расширить свои навыки?
Slurm подготовили для вас особенный продукт! Оставить заявку по ссылке — https://slurm.club/3MeqNEk
[Visual Studio] Не удаётся открыть . для записи
1>—— Построение начато: проект: game_life, Конфигурация: Debug Win32 ——
1>Построение начато 14.08.2014 13:32:36.
1>InitializeBuildStatus:
1> Обращение к «Debuggame_life.unsuccessfulbuild».
1>ClCompile:
1> Для всех выходных данных обновления не требуется.
1>LINK : fatal error LNK1168: не удается открыть . game_life.exe для записи
1>
1>Сбой построения.
1>
1>Затраченное время: 00:00:00.55
========== Построение: успешно: 0, с ошибками: 1, без изменений: 0, пропущено: 0 ==========
Иногда выскакивает такая магическая ошибка и очень мешает работать.
Хм. Самое очевидное, приложение все еще может работать на момент пересборки.
me, да нет, не работает оно..
Laynos
> да нет, не работает оно..
Какой то процесс остался висеть.
Тут обычно два варианта — либо он сам отвалится через несколько секунд/минут.
Либо открывайте планировщик задач и грохайте вручную.
Kartonagnick
> Какой то процесс остался висеть.
>
> Тут обычно два варианта — либо он сам отвалится через несколько секунд/минут.
> Либо открывайте планировщик задач и грохайте вручную.
А можно как-то VS заставить автоматически его грохать?
Просто очень неудобно работать.
Laynos
Если он остается висеть после закрывания окна, скорее всего это твой многопоточный говнокод виноват.
-Eugene-
о да. Он такой, мой код. Каждый человек, увидевший его, быстро убегает со слезами и годами не выходит из дому. Бойтесь мой говнокод — он нелогичен, поэтому и страшен.
Laynos
Так я угадал, что ты пытаешься что-то делать с потоками?
Мне думается, ты забываешь корректно убить другие потоки. Или корректно завершить 3rdparty-код, который умеет в многопотчность.
-Eugene-
как вариант, он мог просто прибить окно, а mainLoop продолжает крутить )
-Eugene-
ага.
MaxImuS
-Eugene-
скорее всего вы правы. За собой надобно почистить ресурсы и удалить потоки
Хотя у меня такое было даже в одном главном потоке. Когда запускал пример SFML.
MaxImuS
Мне помнится он тут недавно о потоках темы создавал.
А теперь у него характерная для незавершенных потоков проблема.
Хмм, я думаю, где-то здесь есть связь.
-Eugene-
проблема людей, не поняв как работает апп в один, хотя бы, поток, кидаются в многопоточность, так как кто-то сказал, что это круто
Laynos
открой диспетчер задачь и просто посмотри в него, после того, как закрываешь приложение остается оно висеть в процессах или нет
>А можно как-то VS заставить автоматически его грохать?
Можно на prebuild шаг повесить утилитку, которая будет убивать нужный процесс.
ilusha_nil
я думаю, нестоит издеваться над собой, а просто понимать то, что пишешь в коде