Lnk1168 c как исправить
Перейти к содержимому

Lnk1168 c как исправить

  • автор:

Lnk1168 c как исправить

fatal error LNK1168 — Не могу понять почему появляется такая ошибка. У меня Visual Studio 2008. Только чтото поменяю в коде как выскакивает такой бред. Что мне с етим лишним EXE делать ? Спасибо.

P.S. : Вся ошибка выглядит так : LINK : fatal error LNK1168: не удается открыть E:\Documents and Settings\Oleg\Мои документы\Visual Studio 2008\Projects\Win32-проба\Debug\Домашня з Win32 №4(2).exe для записи

Последний раз редактировалось Луцк; 07.04.2010 в 20:00 .
Пользователь
Регистрация: 10.03.2011
Сообщений: 68

В таком случае чаще всего нада закрывать ваш исполнимый файл через диспетчер задач. Визуально он вроди бы закрылся, а на самом деле продолжает висеть.
Но не всегда проблема в этом, например у Меня сейчас моего исполнимого файла нет в диспетчере, CleanSolution и Rebuil не помогают

Lnk1168 c как исправить

Наши сайты

Форум программистов «Весельчак У» > Программирование > C/C++ > WinAPI & Visual C++ (Модератор: Вад)

Подразделы
DirectX 643 Сообщений
53 Тем
Последний ответ от Алексей++
в Re: Вращающийся КУБ Dire.
27-12-2012 10:42
Страниц: 1 . 4 5 6 [7] 8 9 10 . 27 Вниз
Страниц: 1 . 4 5 6 [7] 8 9 10 . 27 Вверх

Форум программистов «Весельчак У» > Программирование > C/C++ > WinAPI & Visual C++ (Модератор: Вад)

Тема с Вашими ответами
Обычная тема
Популярная тема (более 100 ответов)
Очень популярная тема (более 500 ответов)
Заблокированная тема
Прикрепленная тема

LINK: fatal error LNK1168: не удается открыть exe для записи

1>—— Построение начато: проект: Курсовая лаба, Конфигурация: Debug Win32 ——
1>Компоновка.
1>LINK : fatal error LNK1168: не удается открыть C:\Users\Богдан\Documents\Visual Studio 2008\Projects\Ируся\Курсовая лаба\Debug\Курсовая лаба.exe для записи
1>Журнал построения был сохранен в «file://c:\Users\Богдан\Documents\Visual Studio 2008\Projects\Ируся\Курсовая лаба\Курсовая лаба\Debug\BuildLog.htm»
1>Курсовая лаба — ошибок 1, предупреждений 0
========== Построение: успешно: 0, с ошибками: 1, без изменений: 0, пропущено: 0 ==========

94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
Ответы с готовыми решениями:

fatal error LNK1168: не удается открыть F:\Interp\Debug\Interp.exe для записи
После того,как в 38 строке к k приписал "=0"начало выбивать ошибку "fatal error LNK1168: не удается.

LINK : fatal error LNK1168: не удается открыть
1>LINK : fatal error LNK1168: не удается открыть C:\Users\Егор\Documents\Visual Studio.

LINK : fatal error LNK1104: не удается открыть файл «LIBC.lib»
ошибку выводит когда включаю в проект Lua много гуглил и везде говорят в игнор поставить но от.

LINK : fatal error LNK1104: не удается открыть файл «libboost_thread-vc110-mt-1_50.lib»
Итак, я скачал буст (В C:\). Запустил из папки буста bjam.exe. После этого из этой же папки.

VC++ fatal error LNK1168: cannot open filename.exe for writing

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:\Users\username\Documents\Visual Studio 2010\Projects\console\Debug\console.exe for writing**

  1. The app is not running and it’s not shown in the Task Manager.
  2. Going into the project directory and trying to remove it with hands comes with success but the file APPEARS AGAIN FROM NOWHERE.
  3. The system restore is disabled.
  4. I also tried to take the ownership of the whole damn drive.
  5. Every time I delete the file it recreates itself again but sometimes it stops doing that.
  6. If I delete the file (and it recreates after that), and then I start sysinternals procmon then the file disappears.
  7. 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?

4,429 2 2 gold badges 22 22 silver badges 44 44 bronze badges
asked Aug 25, 2012 at 17:25
513 1 1 gold badge 4 4 silver badges 4 4 bronze badges
For me a simple reboot fixed this error (similar to CodeMed’s answer below).
Aug 7, 2014 at 19:36

17 Answers 17

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
9,557 71 71 gold badges 215 215 silver badges 367 367 bronze badges

This fixed it for me. I will say though, I had to look under processes in windows task manager, because the console window disappeared.

Mar 8, 2015 at 19:44

I am not able to close by X button is there any other way. One way i found is lose your IDE and then it will automatically close prompt window.

Aug 9, 2017 at 7:11

Win10 VS 2017. Quitting everything until there was nothing of relevance in the task manager doesn’t help, instead I have to reboot the machine. When shutting down an error dialog suddenly appears and is immediately closed out of, presumably this dialog needed to be closed before the debugger could access the app again but the dialog does not appear (until shutting down). Perhaps this process existed in the task manager but with a generic/unhelpful name.

May 6, 2019 at 16:59

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.

Jun 19, 2019 at 21:23
@CodeMed oopsie..this is why I love StackOverflow
Mar 30, 2020 at 12:26

Enable “Application Experience” service. Launch a console window and type net start AeLookupSvc

answered Aug 25, 2012 at 17:48
Software_Designer Software_Designer
8,486 3 3 gold badges 25 25 silver badges 29 29 bronze badges
Windows 10 gives me the error : «The service name is invalid»
Dec 21, 2015 at 15:28
How do I enable application experience?
Sep 6, 2016 at 17:10

It worked for me. Another ridiculous Windows hack. Microsoft should pay Google a hefty sum for supporting its OS, otherwise no one would be able to use the thing.

Nov 27, 2016 at 13:15
Worked for me on windows 7 Visual Studio 2013 C++
Sep 10, 2017 at 14:11

@AhmetTavli I have the same problem. The service seems to not be available in Win10. Have you found a solution to this?

Apr 18, 2019 at 6:32

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%\source\repos\ProjectFolderName\Debug 

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
4,429 2 2 gold badges 22 22 silver badges 44 44 bronze badges
Thanks, this did it for me. Had the exact same problem (.exe wouldn’t show up in Task Manager)
Oct 9, 2020 at 12:07

Restarting Visual Studio solved the problem for me.

answered Jan 7, 2017 at 18:15
Aleksei Mialkin Aleksei Mialkin
2,277 1 1 gold badge 28 28 silver badges 26 26 bronze badges
I actually had to restart the whole computer.
Mar 22, 2020 at 13:38

In my case, cleaning and rebuilding the project resolved the problem.

13.1k 16 16 gold badges 70 70 silver badges 121 121 bronze badges
answered Mar 2, 2014 at 15:35
121 1 1 silver badge 5 5 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
5,529 6 6 gold badges 32 32 silver badges 47 47 bronze badges

This solved same problem I also came across very well

  1. Close the app if it is still running on the taskbar,
  2. Open cmd (command prompt) and run the following
taskkill /F /IM ApplicationName.exe 
  1. Rebuild your project!! error solved!

921 9 9 silver badges 27 27 bronze badges
answered Sep 25, 2022 at 1:11
161 1 1 gold badge 1 1 silver badge 8 8 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
Sparsh Jain Sparsh Jain
19 1 1 bronze badge

Hi Sparsh Jain, the question mentioned that «visual studio express 2010» on «W7 SP1» was being used. Moreover I don’t think that your answer doesn’t add anything that existing answers haven’t covered.

Apr 8, 2015 at 18:05

Thanks! I did that with VS 2015 on windows 10 and it helped me 🙂 I think that’s the easiest way to solve this problem.

Jun 21, 2017 at 4:59

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
Back2Lobby Back2Lobby
534 6 6 silver badges 12 12 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
144 1 1 gold badge 3 3 silver badges 11 11 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 Stearn Laurie Stearn
959 1 1 gold badge 13 13 silver badges 34 34 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
49 1 1 silver badge 4 4 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
586 4 4 silver badges 11 11 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
85 1 1 silver badge 15 15 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:Out\Build\VS12_app\Debug\platform_test.exe for writing [C:Build\VS12_app\platform_test.vcxproj]

I searched for C:Out\Build\VS12_app\Debug\platform_test.exe in Process Explorer, killed it and I was able to compile.

answered Sep 15, 2022 at 11:15
113 2 2 silver badges 10 10 bronze badges

The other answers to this question provide one-off, manual solutions to the problem. However, the root cause of the problem in many cases is that Visual Studio is leaving your previous debug session’s process running, or at least extant in a way that maintains a lock on the executable file. You can set Visual Studio to automatically kill such a process when you stop debugging. This would then typically prevent you from getting this error, as well as needing to take manual steps to rectify it.

To instruct Visual Studio to automatically kill the process when debugging stops, set the following option:

Tools—>Options—>Debugging—>General—>Automatically close the console when debugging stops

On Visual Studio 2022 this is very near the bottom of this list.

Personally, I will run a process under Visual Studio with F5 (Debug) which compiles and links the binary first if necessary.

Then the binary crashes, or hits a breakpoint, or I’m tired of waiting, so I will change the source then hit SHIFT-F5 F5. This is «Debug Stop» followed by «Debug» again. I just do that by reflex.

I’m not sure if this flag’s default value changes periodically between releases of Visual Studio, but I don’t recall ever having to set this option before. I generally create very few projects but work on them many years, so maybe I set this option manually every time then forget about it. But on 2022, it does need to be set. I’ve set it and now can work as I recall working in the past.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *