Visual studio ошибка c1083

Search code, repositories, users, issues, pull requests…

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

For people having problem related to «error C1083: Cannot open source file»:

Error is caused by settings in *.vcxproj file. Probably you deleted/moved source file by file explorer, not by Visual Studio’s «Solution Explorer». Thus, your *.vcxproj file is corrupted. Fix is to manually correct settings in *.vcxproj file.

How Visual Studio settings files work

Visual Studio saves solution’s info into file. This file is usually in project’s solution directory, has extension .sln and base name is same as name of solution, f.ex.:

NameOfSolution.sln

Similarly, project’s info is saved into one file (each project has its own file). Base name of this file is name of project, extension is .vcxproj, and usually is located in subdirectory named as your project, f.ex.:

NameOf1stProject/NameOf1stProject.vcxproj

NameOf2ndProject/NameOf2ndProject.vcxproj

Both *.sln and *.vcxproj files are textual files. You can open them by using Notepad.

How to fix problem

  1. Find *.vcxproj file responsible for your project.

    If you don’t know where it is, open in Notepad the *.sln file of your solution. Search for name of your solution. You will find line like:

    Project("{9AA9CEB8-8B4A-11D0-8D22-00B0C01AA943}") = "NameOf1stProject", "NameOf1stProject\NameOf1stProject.vcxproj", "{A8735D0A-25ED-4285-AB8F-AF578D8DB960}"
    

    Value under «NameOf1stProject\NameOf1stProject.vcxproj» is location of *.vcxproj file of your project.

  2. Open found *.vcxproj file by text editor (f.ex. Notepad).

  3. Search for line on which is filename you are struggling with.

    Example: if you are looking for «RemovedFile.cpp«, then you should find line:

    <ClCompile Include="RemovedFile.cpp" />
    
  4. Delete that line.

  5. If you have opened Visual Studio, it asks you if it should refresh solution — select yes. If it is not opened — just start using it.

  6. In case of any problems, try to rebuild solution (top banner -> Build -> Rebuild Solution)

In my cases, it worked. 30 mins of trying to fix, <1 minute of fixing.

I was beginning to use Visual Studio 2013 to work with OpenCV.

I had completed a simple project that I need and was just doing some cleanup.
The compiler begin giving the message.

error C1083: Cannot open source file:

What I have tried so far:

Creating a new console application in a separate file and trying to compile it, just created . -> same error.

Repairing Visual Studio using the original installation disk. -> same result on new just created project «error c1083;

Uninstalling Visual Studio and then reinstalling it. -> same result on new just created project «error c1083»

Things I have noticed. My compiler is not creating a .pch file or at least I cannot find it. I have precompiled headers enabled. /Yc for stdafx.cpp and /Yu. for other files if I have any.

If I use a previously created project that was working the IDE will run it, but if I change anything in the source file I get the same error.

I have tried placing projects in very short paths and in the normal location for the compiler.

Solution explorer sees and will open the source file.

I am beginning to think something is corrupted in my operating system. (Windows 7).
I have been thinking I might format the disk and reinstall Windows, but thought I might ask for suggestions on this problem first.

«
What do you mean by ‘doing some cleanup’? It is quite unlikely that your OS is corrupted. There is probably something wrong with your project properties, but I couldn’t tell you what without better information»

This was just a simple project to place cross hairs on the input from a USB microscope which was spindle mounted on a CNC milling machine for centering purposes. I was just changing the on screen position and size of the cross hairs. Then when I recompiled the problem started. I thought it might be a corrupted file because of the fact that it persisted after uninstalling and reinstalling Visual Studio. The fact that a freshly generated project would not compile made me suspicious.

«
Looks like something in your Project/Properties is not right. It is looking for the files in the wrong directory»

You are probably correct, but I am a novice and have spent many hours trying to find what it may be any suggestions for what settings to change would be greatly appreciated.

«
Do your TMP and TEMP environment variables point to directories that (1) exist (2) you have write permission to and (3) have free space? «

Yes sir The environment variables are set and the directory has read write permission. There is > 1T of free disk space.

«
Also try (with VS closed) deleting the registry keys HKCU\Software\Microsoft\VisualStudio\12.0 and 12.0_Config and the directory %LOCALAPPDATA%\Microsoft\VisualStudio\12.0, then open VS and try again with a fresh project. This will cause VS to regenerate all caches and «transient» information (it will also reset all your settings, so beware).»

Sir: I deleted the keys and the directory you recommended, generated a fresh project and tried to compile it. The compiler generated the same error. I genuinely appreciate the suggestion.

«VS only allows closed source development»

Pointed, consider the source of VS.

  • Remove From My Forums
  • Question

  • I am new to C++ programming in Visual Studio, When I run any c++ program it shows too many build errors. I am using Visual Studio Community 2015. It shows — fatal error C1083: Cannot open include file: ‘stdio.h’: No
    such file or directory

Answers

  • I am new to C++ programming in Visual Studio, When I run any c++ program it shows too many build errors. I am using Visual Studio Community 2015. It shows — fatal error C1083: Cannot open include file: ‘stdio.h’:
    No such file or directory

    Hi,

    According to your description. The compiler generates the c1083 error when it can’t find file. There are some reasons why the compiler generates this
    error. You can see the article. Hope the article can help you to resolve the problem.

    https://msdn.microsoft.com/en-us/library/et4zwx34.aspx?f=255&MSPPError=-2147217396

    If your original problem has been resolved, please mark the thread.

    Best Regards,

    Hart

    • Marked as answer by

      Wednesday, July 12, 2017 2:01 AM

    • Unmarked as answer by
      Rajat Maurya
      Wednesday, July 12, 2017 2:02 AM
    • Marked as answer by
      Rajat Maurya
      Wednesday, July 12, 2017 2:03 AM

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

Всех приветствую! Подскажите в чем может быть проблема: создал в MS Visual Studio 2017 проект из сорсов, вроде все правильно — в коде ошибок нет при сборке проекта на сам код не ругается но при сборке ругается на отсутствие предкомпилированного заголовка для каждого сорса,
всего в проекте три сишных сорс файла т.е. с расширением .c, компилятор ругается примерно след.образом:

Ошибка C1083 Не удается открыть файл предкомпилированный заголовок: Debug\Hmac1.pch: No such file or directory, Hmac1 c:\progs\msvisualstudio\hmac1\hmac1\hmac.c 10

где 10 — номер строки с ошибкой

для каждого из трех .с файлов отдельное сообщение об ошибке, причем для каждого из .с файлов строка с ошибкой — та строка в которой включен хедер stdafx.h: #include «stdafx.h»

который визуал студия настойчиво требует включать в каждый сорс, иначе же без него студия выдает следующую ошибку для каждого сорса в который этот хедер не включен:
Ошибка C1010 непредвиденный конец файла во время поиска предкомпилированного заголовка. Возможно, вы забыли добавить директиву «#include «stdafx.h»» в источник.

Так вот: в свойствах проекта — «C/C++ — предварительно откомпилированные заголовки» — я поставил «Не использовать предварительно откомпилированные заголовки» — жму «Пересобрать решение» все равно таже ошибка C1083
Даже выставил потом в свойствах каждого .с файла — «Не использовать предварительно откомпилированные заголовки» — все равно по прежнему таже самая ошибка С1083 лезет, помогите что делать в чем может быть проблема?

Понравилась статья? Поделить с друзьями:
  • Vitashell произошла ошибка c1 6775 5
  • Visual studio не подчеркивает ошибки
  • Visual studio ошибка 403
  • Vita nostra работа над ошибками дьяченко
  • Vita shell ps vita ошибка c1 6775 5