Visual studio ошибка не удается найти указанный файл

  • Remove From My Forums
  • Вопрос

  • Недавно столкнулся с проблемой в Visual Studio : при попытке компиляции программы в конфигурации debug программа завершается с ошибкой «Невозможно найти указанный файл <путь>». До очистки решения
    программа работала верно, .cpp файл в проект включен, все зависимости в свойствах проекта выставлены, все необходимые файлы в папку debug перенесены. Проверял, не запускает с той же ошибкой даже программу первого урока kuchka-pc
    (http://kychka-pc.ru/sfml/urok-1-podklyuchenie-biblioteki-k-srede-razrabotki-visual-studio-2013.html). Подскажите, в чём может быть проблема? Прикладываю код программы с kuchka-pc, тк. он короче.

    #include <iostream>
    #include <windows.h>
    #include <SFML/Graphics.hpp>
    
    using namespace sf;
    
    int main()
    {
    	RenderWindow window(VideoMode(1366, 768), "1");
    	while (window.isOpen())
    	{
    		Event event;
    		while (window.pollEvent(event))
    		{
    			if (Keyboard::isKeyPressed(Keyboard::Escape))
    				window.close();
    		}
    		window.clear();
    		window.display();
    	}
    	return 0;
    }

Ответы

  • Единственная возможноя причина, это то что берутся заголовочные файлы из одной версии SDK, а тулсет из другой. Если есть старые ненужные версии студии, снесите их, и переустановите SDK нужной версии студии.

    • Предложено в качестве ответа

      6 марта 2018 г. 7:51

    • Помечено в качестве ответа
      Maksim MarinovMicrosoft contingent staff, Moderator
      29 марта 2018 г. 9:57

I installed Visual Studio 2010. I wrote a simple code which I’m sure is correct but unfortunately, when I run the code, I get the error below.

Here is my code:

#include<iostream>
using namespace std;
int main (){ 
  cout <<"Hello StackOverFlow ;)";
  return 0;
}

And here is the error:

Unable to start program ‘C:\Users\Soheil\Desktop\New folder\sam\Debug\sam.exe
The system cannot find the file specified

Would you help me solve the issue? Should I define the project in a
specific directory? I’ve spent a ton of hours to solve this issue and
have not had any success yet.

pmr's user avatar

pmr

58.8k10 gold badges114 silver badges156 bronze badges

asked May 12, 2013 at 20:51

Sam's user avatar

21

This is a first step for somebody that is a beginner. Same thing happened to me:

Look in the Solution Explorer box to the left. Make sure that there is actually a .cpp file there. You can do the same by looking the .cpp file where the .sln file for the project is stored. If there is not one, then you will get that error.

When adding a cpp file you want to use the Add new item icon. (top left with a gold star on it, hover over it to see the name) For some reason Ctrl+N does not actually add a .cpp file to the project.

Frank Fajardo's user avatar

answered Nov 9, 2013 at 17:44

cdelsola's user avatar

cdelsolacdelsola

4072 gold badges8 silver badges17 bronze badges

1

Encountered the same issue, after downloading a project, in debug mode. Searched for hours without any luck. Following resolved my problem;

Project Properties -> Linker -> Output file -> $(OutDir)$(TargetName)$(TargetExt)

It was previously pointing to a folder that MSVS wasn’t running from whilst debugging mode.

EDIT: soon as I posted this I came across: unable to start «program.exe» the system cannot find the file specified vs2008 which explains the same thing.

Community's user avatar

answered Mar 20, 2016 at 5:51

ReturnVoid's user avatar

ReturnVoidReturnVoid

1,1061 gold badge11 silver badges18 bronze badges

0

For me, I didn’t have my startup project set in Solution Explorer.

Go to Solution Explorer on the left of VS, right click your unit test project, and choose «set as startup project».

I had just ported my code to a new workspace, and forgot that when I opened the project in VS in the solution there, that I needed to re-set my startup project.

answered Apr 11, 2017 at 15:35

Michele's user avatar

MicheleMichele

3,63712 gold badges47 silver badges82 bronze badges

I know this is an old thread, but for any future visitors, the cause of this error is most likely because you haven’t built your project from Build > Build Solution. The reason you’re getting this error when you try to run your project is because Visual Studio can’t find the executable file that should be produced when you build your project.

answered Oct 31, 2015 at 16:14

Ethan Bierlein's user avatar

Ethan BierleinEthan Bierlein

3,3934 gold badges28 silver badges42 bronze badges

1

As others have mentioned, this is an old thread and even with this thread there tends to be different solutions that worked for different people. The solution that worked for is as follows:

Right Click Project Name > Properties
Linker > General 
Output File > $(OutDir)$(TargetName)$(TargetExt) as indicated by @ReturnVoid
Click Apply

For whatever reason this initial correction didn’t fix my problem (I’m using VS2015 Community to build c++ program). If you still get the error message try the following additional steps:

Back in Project > Properties > Linker > General > Output File > 

You’ll see the previously entered text in bold

Select Drop Down > Select "inherit from parent or project defaults"
Select Apply

Previously bold font is no longer bold

Build > Rebuild > Debug

It doesn’t make since to me to require these additional steps in addition to what @ReturnVoid posted but…what works is what works…hope it helps someone else out too. Thanks @ReturnVoid

answered Apr 9, 2016 at 22:24

Chris's user avatar

ChrisChris

9341 gold badge18 silver badges38 bronze badges

1

I came across this problem and none of these solution worked 100%

In addition to ReturnVoid’s answer which suggested the change

Project Properties -> Linker -> Output file -> $(OutDir)$(TargetName)$(TargetExt)

I needed to changed

Project Properties -> C/C++ -> Debug Information Format -> /Zi

This field was blank for me, changing the contents to /Zi (or /Z7 or /ZI if those are the formats you want to use) allowed me to debug

answered Jan 9, 2019 at 15:58

rtpax's user avatar

rtpaxrtpax

1,6871 gold badge18 silver badges32 bronze badges

I know this thread is 1 year old but I hope this helps someone, my problem was that I needed to add:

    #include "stdafx.h"

to my project (on the first line), this seems to be the case most of the time!

toastrackengima's user avatar

answered May 28, 2014 at 0:25

Windows65's user avatar

Windows65Windows65

571 silver badge7 bronze badges

2

I got this problem during debug mode and the missing file was from a static library I was using. The problem was solved by using step over instead of step into during debugging

answered Apr 26, 2019 at 0:25

misty's user avatar

mistymisty

111 silver badge4 bronze badges

if vs2010 installed correctly

check file type (.cpp)

just build it again It will automatically fix,, ( if you are using VS 2010 )

answered Aug 12, 2014 at 12:35

ANJi's user avatar

ANJiANJi

278 bronze badges

I had a same problem and i could fixed it!
you should add
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64 for 64 bit system
/ C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib for 32 bit system
in property manager-> Linker-> General->Additional library Directories

maybe it can solve the problem of somebody in the future!

answered Sep 6, 2014 at 15:26

hani89's user avatar

  • Remove From My Forums
  • Вопрос

  • Недавно столкнулся с проблемой в Visual Studio : при попытке компиляции программы в конфигурации debug программа завершается с ошибкой «Невозможно найти указанный файл <путь>». До очистки решения
    программа работала верно, .cpp файл в проект включен, все зависимости в свойствах проекта выставлены, все необходимые файлы в папку debug перенесены. Проверял, не запускает с той же ошибкой даже программу первого урока kuchka-pc
    (http://kychka-pc.ru/sfml/urok-1-podklyuchenie-biblioteki-k-srede-razrabotki-visual-studio-2013.html). Подскажите, в чём может быть проблема? Прикладываю код программы с kuchka-pc, тк. он короче.

    #include <iostream>
    #include <windows.h>
    #include <SFML/Graphics.hpp>
    
    using namespace sf;
    
    int main()
    {
    	RenderWindow window(VideoMode(1366, 768), "1");
    	while (window.isOpen())
    	{
    		Event event;
    		while (window.pollEvent(event))
    		{
    			if (Keyboard::isKeyPressed(Keyboard::Escape))
    				window.close();
    		}
    		window.clear();
    		window.display();
    	}
    	return 0;
    }

Ответы

  • Единственная возможноя причина, это то что берутся заголовочные файлы из одной версии SDK, а тулсет из другой. Если есть старые ненужные версии студии, снесите их, и переустановите SDK нужной версии студии.

    • Предложено в качестве ответа

      6 марта 2018 г. 7:51

    • Помечено в качестве ответа
      Maksim MarinovMicrosoft contingent staff, Moderator
      29 марта 2018 г. 9:57

I installed Visual Studio 2010. I wrote a simple code which I’m sure is correct but unfortunately, when I run the code, I get the error below.

Here is my code:

#include<iostream>
using namespace std;
int main (){ 
  cout <<"Hello StackOverFlow ;)";
  return 0;
}

And here is the error:

Unable to start program ‘C:UsersSoheilDesktopNew foldersamDebugsam.exe
The system cannot find the file specified

Would you help me solve the issue? Should I define the project in a
specific directory? I’ve spent a ton of hours to solve this issue and
have not had any success yet.

pmr's user avatar

pmr

57.8k10 gold badges110 silver badges155 bronze badges

asked May 12, 2013 at 20:51

Sam's user avatar

21

This is a first step for somebody that is a beginner. Same thing happened to me:

Look in the Solution Explorer box to the left. Make sure that there is actually a .cpp file there. You can do the same by looking the .cpp file where the .sln file for the project is stored. If there is not one, then you will get that error.

When adding a cpp file you want to use the Add new item icon. (top left with a gold star on it, hover over it to see the name) For some reason Ctrl+N does not actually add a .cpp file to the project.

Frank Fajardo's user avatar

answered Nov 9, 2013 at 17:44

cdelsola's user avatar

cdelsolacdelsola

3972 gold badges7 silver badges17 bronze badges

1

Encountered the same issue, after downloading a project, in debug mode. Searched for hours without any luck. Following resolved my problem;

Project Properties -> Linker -> Output file -> $(OutDir)$(TargetName)$(TargetExt)

It was previously pointing to a folder that MSVS wasn’t running from whilst debugging mode.

EDIT: soon as I posted this I came across: unable to start «program.exe» the system cannot find the file specified vs2008 which explains the same thing.

Community's user avatar

answered Mar 20, 2016 at 5:51

ReturnVoid's user avatar

ReturnVoidReturnVoid

1,0711 gold badge10 silver badges17 bronze badges

0

I know this is an old thread, but for any future visitors, the cause of this error is most likely because you haven’t built your project from Build > Build Solution. The reason you’re getting this error when you try to run your project is because Visual Studio can’t find the executable file that should be produced when you build your project.

answered Oct 31, 2015 at 16:14

Ethan Bierlein's user avatar

Ethan BierleinEthan Bierlein

3,2634 gold badges28 silver badges41 bronze badges

1

As others have mentioned, this is an old thread and even with this thread there tends to be different solutions that worked for different people. The solution that worked for is as follows:

Right Click Project Name > Properties
Linker > General 
Output File > $(OutDir)$(TargetName)$(TargetExt) as indicated by @ReturnVoid
Click Apply

For whatever reason this initial correction didn’t fix my problem (I’m using VS2015 Community to build c++ program). If you still get the error message try the following additional steps:

Back in Project > Properties > Linker > General > Output File > 

You’ll see the previously entered text in bold

Select Drop Down > Select "inherit from parent or project defaults"
Select Apply

Previously bold font is no longer bold

Build > Rebuild > Debug

It doesn’t make since to me to require these additional steps in addition to what @ReturnVoid posted but…what works is what works…hope it helps someone else out too. Thanks @ReturnVoid

answered Apr 9, 2016 at 22:24

Chris's user avatar

ChrisChris

9341 gold badge16 silver badges37 bronze badges

1

I came across this problem and none of these solution worked 100%

In addition to ReturnVoid’s answer which suggested the change

Project Properties -> Linker -> Output file -> $(OutDir)$(TargetName)$(TargetExt)

I needed to changed

Project Properties -> C/C++ -> Debug Information Format -> /Zi

This field was blank for me, changing the contents to /Zi (or /Z7 or /ZI if those are the formats you want to use) allowed me to debug

answered Jan 9, 2019 at 15:58

rtpax's user avatar

rtpaxrtpax

1,64716 silver badges31 bronze badges

For me, I didn’t have my startup project set in Solution Explorer.

Go to Solution Explorer on the left of VS, right click your unit test project, and choose «set as startup project».

I had just ported my code to a new workspace, and forgot that when I opened the project in VS in the solution there, that I needed to re-set my startup project.

answered Apr 11, 2017 at 15:35

Michele's user avatar

MicheleMichele

3,45411 gold badges44 silver badges79 bronze badges

I know this thread is 1 year old but I hope this helps someone, my problem was that I needed to add:

    #include "stdafx.h"

to my project (on the first line), this seems to be the case most of the time!

Toastrackenigma's user avatar

answered May 28, 2014 at 0:25

Windows65's user avatar

Windows65Windows65

571 silver badge7 bronze badges

2

I got this problem during debug mode and the missing file was from a static library I was using. The problem was solved by using step over instead of step into during debugging

answered Apr 26, 2019 at 0:25

misty's user avatar

mistymisty

111 silver badge4 bronze badges

if vs2010 installed correctly

check file type (.cpp)

just build it again It will automatically fix,, ( if you are using VS 2010 )

answered Aug 12, 2014 at 12:35

ANJi's user avatar

ANJiANJi

278 bronze badges

I had a same problem and i could fixed it!
you should add
C:Program Files (x86)Microsoft SDKsWindowsv7.1ALibx64 for 64 bit system
/ C:Program Files (x86)Microsoft SDKsWindowsv7.1ALib for 32 bit system
in property manager-> Linker-> General->Additional library Directories

maybe it can solve the problem of somebody in the future!

answered Sep 6, 2014 at 15:26

hani89's user avatar

I installed Visual Studio 2010. I wrote a simple code which I’m sure is correct but unfortunately, when I run the code, I get the error below.

Here is my code:

#include<iostream>
using namespace std;
int main (){ 
  cout <<"Hello StackOverFlow ;)";
  return 0;
}

And here is the error:

Unable to start program ‘C:UsersSoheilDesktopNew foldersamDebugsam.exe
The system cannot find the file specified

Would you help me solve the issue? Should I define the project in a
specific directory? I’ve spent a ton of hours to solve this issue and
have not had any success yet.

pmr's user avatar

pmr

57.8k10 gold badges110 silver badges155 bronze badges

asked May 12, 2013 at 20:51

Sam's user avatar

21

This is a first step for somebody that is a beginner. Same thing happened to me:

Look in the Solution Explorer box to the left. Make sure that there is actually a .cpp file there. You can do the same by looking the .cpp file where the .sln file for the project is stored. If there is not one, then you will get that error.

When adding a cpp file you want to use the Add new item icon. (top left with a gold star on it, hover over it to see the name) For some reason Ctrl+N does not actually add a .cpp file to the project.

Frank Fajardo's user avatar

answered Nov 9, 2013 at 17:44

cdelsola's user avatar

cdelsolacdelsola

3972 gold badges7 silver badges17 bronze badges

1

Encountered the same issue, after downloading a project, in debug mode. Searched for hours without any luck. Following resolved my problem;

Project Properties -> Linker -> Output file -> $(OutDir)$(TargetName)$(TargetExt)

It was previously pointing to a folder that MSVS wasn’t running from whilst debugging mode.

EDIT: soon as I posted this I came across: unable to start «program.exe» the system cannot find the file specified vs2008 which explains the same thing.

Community's user avatar

answered Mar 20, 2016 at 5:51

ReturnVoid's user avatar

ReturnVoidReturnVoid

1,0711 gold badge10 silver badges17 bronze badges

0

I know this is an old thread, but for any future visitors, the cause of this error is most likely because you haven’t built your project from Build > Build Solution. The reason you’re getting this error when you try to run your project is because Visual Studio can’t find the executable file that should be produced when you build your project.

answered Oct 31, 2015 at 16:14

Ethan Bierlein's user avatar

Ethan BierleinEthan Bierlein

3,2634 gold badges28 silver badges41 bronze badges

1

As others have mentioned, this is an old thread and even with this thread there tends to be different solutions that worked for different people. The solution that worked for is as follows:

Right Click Project Name > Properties
Linker > General 
Output File > $(OutDir)$(TargetName)$(TargetExt) as indicated by @ReturnVoid
Click Apply

For whatever reason this initial correction didn’t fix my problem (I’m using VS2015 Community to build c++ program). If you still get the error message try the following additional steps:

Back in Project > Properties > Linker > General > Output File > 

You’ll see the previously entered text in bold

Select Drop Down > Select "inherit from parent or project defaults"
Select Apply

Previously bold font is no longer bold

Build > Rebuild > Debug

It doesn’t make since to me to require these additional steps in addition to what @ReturnVoid posted but…what works is what works…hope it helps someone else out too. Thanks @ReturnVoid

answered Apr 9, 2016 at 22:24

Chris's user avatar

ChrisChris

9341 gold badge16 silver badges37 bronze badges

1

I came across this problem and none of these solution worked 100%

In addition to ReturnVoid’s answer which suggested the change

Project Properties -> Linker -> Output file -> $(OutDir)$(TargetName)$(TargetExt)

I needed to changed

Project Properties -> C/C++ -> Debug Information Format -> /Zi

This field was blank for me, changing the contents to /Zi (or /Z7 or /ZI if those are the formats you want to use) allowed me to debug

answered Jan 9, 2019 at 15:58

rtpax's user avatar

rtpaxrtpax

1,64716 silver badges31 bronze badges

For me, I didn’t have my startup project set in Solution Explorer.

Go to Solution Explorer on the left of VS, right click your unit test project, and choose «set as startup project».

I had just ported my code to a new workspace, and forgot that when I opened the project in VS in the solution there, that I needed to re-set my startup project.

answered Apr 11, 2017 at 15:35

Michele's user avatar

MicheleMichele

3,45411 gold badges44 silver badges79 bronze badges

I know this thread is 1 year old but I hope this helps someone, my problem was that I needed to add:

    #include "stdafx.h"

to my project (on the first line), this seems to be the case most of the time!

Toastrackenigma's user avatar

answered May 28, 2014 at 0:25

Windows65's user avatar

Windows65Windows65

571 silver badge7 bronze badges

2

I got this problem during debug mode and the missing file was from a static library I was using. The problem was solved by using step over instead of step into during debugging

answered Apr 26, 2019 at 0:25

misty's user avatar

mistymisty

111 silver badge4 bronze badges

if vs2010 installed correctly

check file type (.cpp)

just build it again It will automatically fix,, ( if you are using VS 2010 )

answered Aug 12, 2014 at 12:35

ANJi's user avatar

ANJiANJi

278 bronze badges

I had a same problem and i could fixed it!
you should add
C:Program Files (x86)Microsoft SDKsWindowsv7.1ALibx64 for 64 bit system
/ C:Program Files (x86)Microsoft SDKsWindowsv7.1ALib for 32 bit system
in property manager-> Linker-> General->Additional library Directories

maybe it can solve the problem of somebody in the future!

answered Sep 6, 2014 at 15:26

hani89's user avatar

2 / 2 / 0

Регистрация: 13.06.2019

Сообщений: 66

1

03.11.2019, 16:25. Показов 17502. Ответов 6


microsoft visual studio 2019 с пол года работал, но сейчас при попытки отладки выскакивает ошибка «Не удаётся запустить программу LL.exe .Не удаётся найти указанный файл»
Создание нового проекта не помогает.

В чём может быть причина и как её устранить ? Так же менял места сохранения файлов проекта.

Добавлено через 1 час 1 минуту
Переустановка не помогла

Добавлено через 33 минуты
Если вручную добавить файл в проект то всё работает.
Но вопрос остаётся открытым: Почему он сам не может это сделать как делал ранее ?

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

0

Эксперт .NET

6270 / 3898 / 1567

Регистрация: 09.05.2015

Сообщений: 9,190

03.11.2019, 16:29

2

Убедитесь что нет ошибок компиляции.

0

2 / 2 / 0

Регистрация: 13.06.2019

Сообщений: 66

03.11.2019, 16:30

 [ТС]

3

Цитата
Сообщение от Someone007
Посмотреть сообщение

Убедитесь что нет ошибок компиляции

Даже при создании нового проекта с Hello World выскакивает эта ошибка.

0

Эксперт С++

3225 / 2484 / 429

Регистрация: 03.05.2011

Сообщений: 5,165

Записей в блоге: 21

05.11.2019, 17:16

4

Цитата
Сообщение от Triglav86
Посмотреть сообщение

Почему он сам не может это сделать как делал ранее ?

я уже говорил, что vs2019 сырое гуамно..
пользуйтесь vs2017 как минимум до весны следующего года, там видно будет.

0

Эксперт .NET

6270 / 3898 / 1567

Регистрация: 09.05.2015

Сообщений: 9,190

06.11.2019, 04:28

5

Цитата
Сообщение от _lunar_
Посмотреть сообщение

я уже говорил, что vs2019 сырое гуамно

Почему-то у меня никаких проблем с VS2019 нет. Тут очень велика вероятность что проблема в прокладке между монитором и креслом.

0

Эксперт С++

3225 / 2484 / 429

Регистрация: 03.05.2011

Сообщений: 5,165

Записей в блоге: 21

06.11.2019, 09:15

6

Цитата
Сообщение от Someone007
Посмотреть сообщение

Тут очень велика вероятность что проблема в прокладке между монитором и креслом.

типа пошутил умник.
если у тебя нет проблем, значит ты не умеешь пользоваться студией — для юзера 0 уровня всё работает хорошо.

1

6574 / 4559 / 1843

Регистрация: 07.05.2019

Сообщений: 13,726

06.11.2019, 10:57

7

Цитата
Сообщение от Triglav86
Посмотреть сообщение

microsoft visual studio 2019 с пол года работал, но сейчас при попытки отладки выскакивает ошибка «Не удаётся запустить программу LL.exe .Не удаётся найти указанный файл»
Создание нового проекта не помогает.

А сам файл-то есть?

Добавлено через 1 минуту
Посмотри, что у тебя прописано в настройках проекта Debugging->Command

0

1 / 1 / 0

Регистрация: 21.02.2015

Сообщений: 37

1

01.03.2015, 20:38. Показов 7889. Ответов 15


Студворк — интернет-сервис помощи студентам

Здравствуйте, вот такая проблема: В Microsoft Visual Studio при отладке выдает такое сообщение: Не удается найти указанный файл. Программа соответственно не запускается. Тут дело не в коде: даже если запустить пустой шаблон выдает это сообщение. По указанному ей адресу никакого файла нет, то есть она его даже не создает. Антивирусник отключал, все равно то же самое выдает. Помогите пожалуйста, очень нравится MVS.



0



Модератор

Эксперт С++

13405 / 10515 / 6283

Регистрация: 18.12.2011

Сообщений: 28,072

01.03.2015, 21:20

2

Смотрите сообщения компиляции.
Там должно быть написано, почему нельзя создать исполняемый файл.



0



1 / 1 / 0

Регистрация: 21.02.2015

Сообщений: 37

02.03.2015, 10:48

 [ТС]

3

При компиляции пишет:
========== Построение: успешно: 0, с ошибками: 0, без изменений: 1, пропущено: 0 ==========
Более ничего не выдает.



0



940 / 868 / 355

Регистрация: 10.10.2012

Сообщений: 2,706

02.03.2015, 11:04

4

Цитата
Сообщение от Alexandr_Saenko
Посмотреть сообщение

очень нравится MVS.

Когда успела понравиться? До этого всё нормально работало? Когда стало криво работать?



0



1 / 1 / 0

Регистрация: 21.02.2015

Сообщений: 37

02.03.2015, 11:08

 [ТС]

5

Нет, работала криво всегда. Ни разу ни одного успешного запуска программы. А успешную ее работу и функции я видел на видео-уроках. На Dev кодю, но он не поддерживает многие функции, как вижуал студио



0



940 / 868 / 355

Регистрация: 10.10.2012

Сообщений: 2,706

02.03.2015, 11:21

6

Студия с офсайта? Для Desktop? Почему и 12-я, и 13-я (в заголовке темы)? ОС какая? Опиши подробно, как проект создаёшь.

Добавлено через 3 минуты
И выложи скрин окна студии с проектом, чтобы были видны код, файлы проекта, и результат компиляции (после F7).



0



1 / 1 / 0

Регистрация: 21.02.2015

Сообщений: 37

02.03.2015, 11:32

 [ТС]

7

Нет, студия не с офсайта, а с рутрекера, для десктопа. Сначала установил 13, такая же ошибка, потом вычитал где-то о проблемах совместимости с 7-кой, скачал 2012, но такая же проблема. ОС — 7 домашняя базовая.
Проект создаю следующим образом: Файл — Создать-Проект-Консольное приложение Win32-Пустой проект. Потом в проекте Файл-Создать-Файл — Файл C++. И уже пустой не может запустить, при компиляции пишет:
1>—— Построение начато: проект: ConsoleApplication7, Конфигурация: Debug Win32 ——
========== Построение: успешно: 1, с ошибками: 0, без изменений: 0, пропущено: 0 ==========

Добавлено через 5 минут
Скрин блин делать не умею.



0



940 / 868 / 355

Регистрация: 10.10.2012

Сообщений: 2,706

02.03.2015, 11:41

8

Лучший ответ Сообщение было отмечено Alexandr_Saenko как решение

Решение

Создай новый проект, и вот это:

Цитата
Сообщение от Alexandr_Saenko
Посмотреть сообщение

Потом в проекте Файл-Создать-Файл — Файл C++.

по-другому сделай: Ctrl+Shift+A, выберешь файл С++, дашь имя, файл появится в проекте (в обозревателе решений) и окроется в редакторе кода, напишешь туда код. Кстати, какой код пишешь в файл?



1



1 / 1 / 0

Регистрация: 21.02.2015

Сообщений: 37

02.03.2015, 11:42

 [ТС]

9

Microsoft Visual Studio 2012/13 Не удается найти указанный файл



0



1 / 1 / 0

Регистрация: 21.02.2015

Сообщений: 37

02.03.2015, 11:50

 [ТС]

10

СПасибо, все получилось!!!!!! Если файл был пустой, он выдавал ошибку не удается найти файл, когда я написал прогу Hello, World, он запустился, спасибо большое!!!!!



0



0 / 0 / 0

Регистрация: 02.03.2015

Сообщений: 2

02.03.2015, 11:50

11

Alexandr_Saenko, не хватает функции main



0



Эксперт PHP

3106 / 2591 / 1219

Регистрация: 14.05.2014

Сообщений: 7,236

Записей в блоге: 1

02.03.2015, 11:51

12

Alexandr_Saenko, У Вас действительно пустой проект. Ни одного файла в нем нет.



1



lss

940 / 868 / 355

Регистрация: 10.10.2012

Сообщений: 2,706

02.03.2015, 11:55

13

Скрин понятен, у тебя в проекте файла нет, а в файле кода. Добавь файл, как я написал. Код туда такой скопируй:

C++
1
2
3
4
5
6
7
8
9
10
#include <iostream>
using namespace std;
 
int main()
{   
    cout << "Hello, world!" << endl;
    
    system("pause");
    return 0;
}

Добавлено через 3 минуты

Цитата
Сообщение от Alexandr_Saenko
Посмотреть сообщение

Если файл был пустой, он выдавал ошибку не удается найти файл, когда я написал прогу Hello, World, он запустился,

Нет, тут другое было… Кроме кода, нужно, чтобы файл (.cpp) был в проекте (присутствовал в обозревателе решений).



0



1 / 1 / 0

Регистрация: 21.02.2015

Сообщений: 37

02.03.2015, 12:29

 [ТС]

14

А вообще где можно скачать руководство по MVS 2012/13?

Добавлено через 25 минут
Еще вопрос: если я открываю старый проект, я нажимаю Ctrl+Shift+A, новый файл не создается, как быть в этом случае?

Добавлено через 6 минут
Все с этим разобрался, нормально создает все файлы



0



Форумчанин

Эксперт CЭксперт С++

8215 / 5045 / 1437

Регистрация: 29.11.2010

Сообщений: 13,453

02.03.2015, 14:49

15

Цитата
Сообщение от Alexandr_Saenko
Посмотреть сообщение

А вообще где можно скачать руководство по MVS 2012/13?

Вам видимо это http://www.visualstudio.com/ge… d-tasks-vs



1



1 / 1 / 0

Регистрация: 21.02.2015

Сообщений: 37

02.03.2015, 14:55

 [ТС]

16

Спасибо



0



Перейти к контенту

  • Remove From My Forums
  • Вопрос

  • Недавно столкнулся с проблемой в Visual Studio : при попытке компиляции программы в конфигурации debug программа завершается с ошибкой «Невозможно найти указанный файл <путь>». До очистки решения
    программа работала верно, .cpp файл в проект включен, все зависимости в свойствах проекта выставлены, все необходимые файлы в папку debug перенесены. Проверял, не запускает с той же ошибкой даже программу первого урока kuchka-pc
    (http://kychka-pc.ru/sfml/urok-1-podklyuchenie-biblioteki-k-srede-razrabotki-visual-studio-2013.html). Подскажите, в чём может быть проблема? Прикладываю код программы с kuchka-pc, тк. он короче.

    #include <iostream>
    #include <windows.h>
    #include <SFML/Graphics.hpp>
    
    using namespace sf;
    
    int main()
    {
    	RenderWindow window(VideoMode(1366, 768), "1");
    	while (window.isOpen())
    	{
    		Event event;
    		while (window.pollEvent(event))
    		{
    			if (Keyboard::isKeyPressed(Keyboard::Escape))
    				window.close();
    		}
    		window.clear();
    		window.display();
    	}
    	return 0;
    }

Ответы

  • Единственная возможноя причина, это то что берутся заголовочные файлы из одной версии SDK, а тулсет из другой. Если есть старые ненужные версии студии, снесите их, и переустановите SDK нужной версии студии.

    • Предложено в качестве ответа

      6 марта 2018 г. 7:51

    • Помечено в качестве ответа
      Maksim MarinovMicrosoft contingent staff, Moderator
      29 марта 2018 г. 9:57

I keep getting this error with these lines of code:

include <iostream>

int main()
    {

        cout << "Hello World" >>;
        system("pause");
        return 0;
    }

«The system cannot find the file specified»

enter image description here

asked Jul 30, 2013 at 12:15

Mr. Supasheva's user avatar

Mr. SupashevaMr. Supasheva

1831 gold badge2 silver badges13 bronze badges

4

The system cannot find the file specified usually means the build failed (which it will for your code as you’re missing a # infront of include, you have a stray >> at the end of your cout line and you need std:: infront of cout) but you have the ‘run anyway’ option checked which means it runs an executable that doesn’t exist. Hit F7 to just do a build and make sure it says ‘0 errors’ before you try running it.

Code which builds and runs:

#include <iostream>

int main()
{
   std::cout << "Hello World";
   system("pause");
   return 0;
}

answered Jul 30, 2013 at 12:20

Mike Vine's user avatar

Mike VineMike Vine

9,19425 silver badges43 bronze badges

The code should be :

#include <iostream>
using namespace std;

int main() {
    cout << "Hello World";
    return 0;
}

Or maybe :

#include <iostream>

int main() {
    std::cout << "Hello World";
    return 0;
}

Just a quick note: I have deleted the system command, because I heard it’s not a good practice to use it. (but of course, you can add it for this kind of program)

answered Jul 30, 2013 at 12:22

Rak's user avatar

5

I had a same problem and this fixed it:

You should add:

C:Program Files (x86)Microsoft SDKsWindowsv7.1ALibx64 for 64 bit system

C:Program Files (x86)Microsoft SDKsWindowsv7.1ALib for 32 bit system

in Property Manager>Linker>General>Additional Library Directories

JustinJDavies's user avatar

answered Sep 6, 2014 at 15:19

hani89's user avatar

Another take on this that hasn’t been mentioned here is that, when in debug, the project may build, but it won’t run, giving the error message displayed in the question.

If this is the case, another option to look at is the output file versus the target file. These should match.

A quick way to check the output file is to go to the project’s property pages, then go to Configuration Properties -> Linker -> General (In VS 2013 — exact path may vary depending on IDE version).

There is an «Output File» setting. If it is not $(OutDir)$(TargetName)$(TargetExt), then you may run into issues.

This is also discussed in more detail here.

Community's user avatar

answered Aug 19, 2016 at 15:18

Aaron Thomas's user avatar

Aaron ThomasAaron Thomas

5,0048 gold badges42 silver badges89 bronze badges

This is because you have not compiled it. Click ‘Project > compile’. Then, either click ‘start debugging’, or ‘start without debugging’.

PPCMD's user avatar

answered Jan 1, 2014 at 13:11

anushang's user avatar

1

I resolved this issue after deleting folder where I was trying to add the file in Visual Studio. Deleted folder from window explorer also. After doing all this, successfully able to add folder and file.

answered Jan 22, 2021 at 7:40

Vinay Pal's user avatar

I was getting the error because of two things.

  1. I opened an empty project

  2. I didn’t add #include «stdafx.h»

It ran successfully on the win 32 console.

Sabito stands with Ukraine's user avatar

answered Jul 30, 2013 at 13:12

Mr. Supasheva's user avatar

Mr. SupashevaMr. Supasheva

1831 gold badge2 silver badges13 bronze badges

Создаю проект: File > New > Project… > Empty Project

Создаю файл: File > New > File.. > C++ File

Пишу стандартную программу «Hello, world!»

#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
     cout << "Hello, world!" << endl;
     system("pause");
     return 0;
}

Жму ctrl+f5. Идёт построение, ошибок в коде нет, но выскакивает ошибка «не удаётся запустить программу «путь до exe файла» Не удаётся найти указанный файл.

Скриншот

Самого exe файла по этому пути нет, он даже не создаётся.

Буду признателен за вашу помощь.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace Students
{
    struct Student
    {
        public string Surname { get; set; }
        public string Name { get; set; }
        public string Patronymic { get; set; }
        public string Sex { get; set; }
        public string Faculty { get; set; }
        public string Course { get; set; }
        public string Group { get; set; }
 
        public int _Math { get; set; }
        public int MatLog { get; set; }
        public int Informat { get; set; }
        public int Sistem { get; set; }
        public int Priklad { get; set; }
 
        public string Locality { get; set; }
 
    }
 
    class Students
    {
        List<Student> students;
        string filename;
        public Students(string file)
        {
            if (!File.Exists(file))
            {
                throw new FileNotFoundException();
            }
            filename = file;
            students = new List<Student>();
            LoadFile();
        }
        private void LoadFile()
        {
            string[] lines = File.ReadAllLines(@filename);
            for (int i = 0; i < lines.Length; i++)
            {
                students.Add(new Student
                {
                    Surname = lines[i++],
                    Name = lines[i++],
                    Patronymic = lines[i++],
                    Sex = lines[i++],
                    Faculty = lines[i++],
                    Course = lines[i++],
                    Group = lines[i++],
                    _Math = int.Parse(lines[i++]),
                    MatLog = int.Parse(lines[i++]),
                    Informat = int.Parse(lines[i++]),
                    Sistem = int.Parse(lines[i++]),
                    Priklad = int.Parse(lines[i++]),
                    Locality = lines[i++],
                });
            }
        }
 
        public void Print()
        {
 
            students = students.OrderByDescending(st => (new int[] { st._Math, st.MatLog, st.Informat, st.Sistem, st.Priklad }).Average()).ToList();
 
            foreach (Student st in students)
 
            {
 
                Console.Write("{0} {1} {2}", st.Surname, st.Name, st.Patronymic);
                Console.WriteLine();
                Console.Write("Пол: {0}", st.Sex);
                Console.WriteLine();
                Console.Write("факультет: {0}, ", st.Faculty);
                Console.Write("курс: {0}, ", st.Course);
                Console.Write("группа: {0},", st.Group);
                Console.WriteLine();
                Console.WriteLine("Оценки:");
                Console.WriteLine("Высшая математика: {0}", st._Math);
                Console.WriteLine("Мат. Логика: {0}", st.MatLog);
                Console.WriteLine("Информатика: {0}", st.Informat);
                Console.WriteLine("Системное программирование: {0}", st.Sistem);
                Console.WriteLine("Прикладное программирование: {0}", st.Priklad);
                Console.WriteLine();
 
 
            }
        }
    }
 
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Students st = new Students("students.txt");
                st.Print();
            }
            catch (FileNotFoundException ob)
            {
                Console.WriteLine(ob.Message);
            }
            Console.ReadKey();
        }
    }
}

Делаю программу. С виду обычная, начинаю запускать через отладчик Windows Visual Studio. Выдает ошибку «Не удается найти указанный файл». Я новичок, в чем проблема?

<code lang="cpp">
#include <iostream>
using namespace std;
int main {
//setlocale(LC_CTYPE,"rus");
int a, k, d, ck;
int d = 10;
cin >> a;
for (k; k <= 9; k++) {
if (a % d != 0) {
ck = ck + 1;
d = d * 10;
}
else {
ck = k;
k = 9;
}
}
system("pause");
return 0;
}
</code>

Понравилась статья? Поделить с друзьями:
  • Visual studio ошибка не удается запустить программу
  • Visual basic ошибка компиляции
  • Vipnet cryptofile ошибка 32801
  • Visual studio ошибка исключение не обработано
  • Visit workshop display faulty w203 ошибка