- 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»
asked Jul 30, 2013 at 12:15
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 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
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
answered Sep 6, 2014 at 15:19
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.
answered Aug 19, 2016 at 15:18
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’.
answered Jan 1, 2014 at 13:11
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
I was getting the error because of two things.
-
I opened an empty project
-
I didn’t add #include «stdafx.h»
It ran successfully on the win 32 console.
answered Jul 30, 2013 at 13:12
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>