Не удается открыть файл включение sdl h no such file or directory
I installed the following libraries, per the instructions,
However, when I configure the installation with,
I get the following message,
I thought this was included in the libsdl-ttf2.0-dev? Anyone have any clues what is going on? Any help would be much appreciated.
Is there a file config.log that shows more details of the error? Possibly configure is looking in the wrong location.
Would it be in one of the logs in /var/log/ directory? I am looking look through the dpkg.log and it says, status unpacked lidsdl-ttf2.0-0:i386 2.0.11-3 Status half configured lodsdl-ttf2.0-0:i386 2.0.11-3 Status installed libsdl-ttf2.0-0:i386 2.0.11-3 Is that at all relevant?
config.log will be generated in the same location as the ./configure file and can be opened and searched with gedit or similar. Which version of Ubuntu are you running? I can run the compile in VM to check.
After narrowing down the config.log with steeldriver's suggestion, I got the following result, "checking SDL_ttf.h usability / contest.c:64:21: fatal error: SDL_ttf.h: no such file or directory".
The file may be locked or in use
If you are using another program to edit or access the file, it may have the file locked. Try closing the file in the other program. Sometimes the other program can be Visual Studio itself, if you are using parallel compilation options. If turning off the parallel build option makes the error go away, then this is the problem. Other parallel build systems can also have this issue. Be careful to set file and project dependencies so build order is correct. In some cases, consider creating an intermediate project to force build dependency order for a common file that may be built by multiple projects. Sometimes antivirus programs temporarily lock recently changed files for scanning. If possible, consider excluding your project build directories from the antivirus scanner.
The wrong version of a file name is included
Предкомпилированные заголовки еще не скомпилированы
Если проект настроен для использования предварительно скомпилированных заголовков, необходимо создать соответствующие .pch файлы, чтобы можно было скомпилировать файлы, использующие содержимое заголовка. например, pch.cpp файл ( stdafx.cpp в Visual Studio 2017 и более ранних версий) автоматически создается в каталоге проекта для новых проектов. Сначала необходимо скомпилировать этот файл, чтобы создать предкомпилированные файлы заголовков. В типичном проекте процесса сборки это выполняется автоматически. Дополнительные сведения см. в разделе Создание предкомпилированных файлов заголовков.
Пример
В следующем примере создается ошибка C1083, если файл "test.h" заголовка не существует в исходном каталоге или в пути поиска include.
Сведения о том, как создавать проекты C/C++ в интегрированной среде разработки или в командной строке, а также сведения о настройке переменных среды см. в разделе проекты и сборки систем.
The compiler generates a C1083 error when it can’t find a file it requires. There are many possible causes for this error. An incorrect include search path or missing or misnamed header files are the most common causes, but other file types and issues can also cause C1083. Here are some of the common reasons why the compiler generates this error.
Проблемы с библиотекой сторонних производителей и vcpkg
если вы видите эту ошибку при попытке настроить библиотеку стороннего производителя в рамках сборки, рассмотрите возможность использования vcpkg, диспетчера пакетов C++ для установки и сборки библиотеки. vcpkg поддерживает большой и растущей список библиотек сторонних производителейи задает все свойства конфигурации и зависимости, необходимые для успешной сборки в рамках проекта.
Дополнительные причины
Вы установили пакет SDK или библиотеку стороннего производителя, но после установки пакета SDK или библиотеки не открывали новое окно командной строки разработчика. Если пакет SDK или библиотека добавляет файлы в путь поиска включаемых файлов, может потребоваться открыть новое окно командной строки разработчика, чтобы получить эти изменения переменных среды.
Файл использует управляемый код, но параметр /clr компилятора не указан. Дополнительные сведения см. в разделе /clr (компиляция среды CLR).
Файл компилируется с использованием другого /analyze параметра компилятора, чем используется для предварительной компиляции заголовков. При предварительной компиляции заголовков для проекта все должны использовать одни и те же /analyze Параметры. дополнительные сведения см. в разделе /analyze (Code Analysis).
файл или каталог был создан подсистема Windows для Linux, учитывается регистр в каждом каталоге, и указанный регистр пути или файла не соответствует регистру пути или файла на диске.
Файл, каталог или диск доступен только для чтения.
Visual Studio или средства командной строки не имеют достаточных разрешений для чтения файла или каталога. это может произойти, например, когда файлы проекта имеют разные права владения, чем процесс, выполняемый Visual Studio или программ командной строки. иногда эту ошибку можно устранить, запустив Visual Studio или командную строку разработчика от имени администратора.
Недостаточно дескрипторов файлов. Закройте часть приложений и повторите компиляцию. Эта ситуация маловероятна в обычных условиях. Однако она может возникать при построении крупных проектов на компьютере с ограниченной физической памятью.
The command line INCLUDE or LIB environment is not set
When the compiler is invoked on the command line, environment variables are often used to specify search paths. If the search path described by the INCLUDE or LIB environment variable is not set correctly, a C1083 error can be generated. We strongly recommend using a developer command prompt shortcut to set the basic environment for command line builds. For more information, see Build C/C++ on the Command Line. For more information about how to use environment variables, see How to: Use Environment Variables in a Build.
The precompiled headers are not yet precompiled
When a project is configured to use precompiled headers, the relevant .pch files have to be created so that files that use the header contents can be compiled. For example, the pch.cpp file ( stdafx.cpp in Visual Studio 2017 and earlier) is automatically created in the project directory for new projects. Compile that file first to create the precompiled header files. In the typical build process design, this is done automatically. For more information, see Creating Precompiled Header Files.
The specified file name is wrong
The name of a file may be mistyped. For example,
The file is in your project, but not the include search path
To fix this issue, correct the path that the compiler uses to search for the included or imported file. A new project uses default include search paths. You may have to modify the include search path to add a directory for your project. If you are compiling on the command line, add the path to the INCLUDE environment variable or the /I compiler option to specify the path to the file.
To set the include directory path in Visual Studio, open the project’s Property Pages dialog box. Select VC++ Directories under Configuration Properties in the left pane, and then edit the Include Directories property. For more information about the per-user and per-project directories searched by the compiler in Visual Studio, see VC++ Directories Property Page. For more information about the /I compiler option, see /I (Additional Include Directories).
2 Answers 2
Try: sudo apt-get install libsdl2-ttf-dev
After that, you should find it via:
I was installing gosu gem for Ruby and had the same error, on Ubuntu 16.04. All solutions pointed to installing sdl2 ttf libs, but I already had them all installed. I noticed, however, that I had /usr/include/SDL2/SDL_ttf.h , and the gem included lib directories didn't list that one, but listed /usr/local/include/SDL2/SDL_ttf.h .
I managed to solve the problem by creating a symbolic link with
sudo ln -s /usr/include/SDL2/SDL_ttf.h /usr/local/include/SDL2/
I just experienced this on Ubuntu 18.04, and your solution worked for me. I'm surprised this issue has lasted as long as it has, but that's not all I found surprising. I supplied my own CFLAGS, as in CFLAGS="$(pkg-config --cflags SDL2_ttf)" make , and there was no change. The makefile hard-codes CFLAGS (not even ?= or += but = ) based on the outcome of configure . In my case, this includes -DHAVE_SDL_TTF , which I do, but it omits the discovered path in favor of its own installation path, where of course it never installed SDL_ttf.h. Should be an easy fix, eh?
In case anyone else has this issue, you can either add the path directly to CFLAGS in the Makefile, or you can replace the = with += and prepend flags to your make invocation like I did. My apologies if what I'm talking about is unrelated to your issue, but I suspect that your local installation stepped on your system installation for the same reason.
Компилятор создает ошибку C1083, когда не удается найти требуемый файл. Эта ошибка имеет несколько возможных причин. Наиболее распространенными причинами являются неверный путь поиска include или отсутствующие или неправильно именованные файлы заголовков, но другие типы файлов и проблемы могут также вызвать C1083. Ниже приведены некоторые распространенные причины, по которым компилятор создает эту ошибку.
Additional causes
You have installed an SDK or third-party library, but you have not opened a new developer command prompt window after the SDK or library is installed. If the SDK or library adds files to the INCLUDE path, you may need to open a new developer command prompt window to pick up these environment variable changes.
The file uses managed code, but the compiler option /clr is not specified. For more information, see /clr (Common Language Runtime Compilation).
The file is compiled by using a different /analyze compiler option setting than is used to precompile the headers. When the headers for a project are precompiled, all should use the same /analyze settings. For more information, see /analyze (Code Analysis).
The file or directory was created by the Windows Subsystem for Linux, per-directory case sensitivity is enabled, and the specified case of a path or file does not match the case of the path or file on disk.
The file, the directory, or the disk is read-only.
Visual Studio or the command line tools do not have sufficient permissions to read the file or the directory. This can happen, for example, when the project files have different ownership than the process running Visual Studio or the command line tools. Sometimes this issue can be fixed by running Visual Studio or the developer command prompt as Administrator.
There are not enough file handles. Close some applications and then recompile. This condition is unusual under typical circumstances. However, it can occur when large projects are built on a computer that has limited physical memory.
Указано неверное имя файла
При вводе имени файла допущена ошибка. Например, примененная к объекту директива
может не найти файл, который вы хотели. Большинство файлов заголовков стандартной библиотеки C++ не имеют расширения h. . Чтобы устранить эту проблему, убедитесь, что указано правильное имя файла, как в следующем примере:
Third-party library issues and vcpkg
If you see this error when you are trying to configure a third-party library as part of your build, consider using vcpkg, a C++ package manager, to install and build the library. vcpkg supports a large and growing list of third-party libraries, and sets all the configuration properties and dependencies required for successful builds as part of your project.
Файл не включен в путь поиска включаемых файлов
Это указывает компилятору искать файл в том же каталоге, который содержит исходный файл, а затем искать в других местах, заданных средой сборки. Если кавычки содержат абсолютный путь, компилятор выполняет поиск файла только в этом расположении. Если кавычки содержат относительный путь, компилятор выполняет поиск файла в каталоге относительно исходного каталога.
Если имя заключено в угловые скобки,
Если включаемые файлы находятся в другом каталоге относительно исходного каталога и в директивах Include используется относительный путь, то вместо угловых скобок следует использовать двойные кавычки. Например, если файл myheader.h заголовка находится в подкаталоге именованных заголовков проекта, в этом примере не удается найти файл и вызывается C1083:
но этот пример работает:
Включена неправильная версия имени файла
Example
The following example generates a C1083 error when the header file "test.h" does not exist in the source directory or on the include search path.
For information about how to build C/C++ projects in the IDE or on the command line, and information about setting environment variables, see Projects and build systems.
Не удается открыть файл включение: separate.h: No such file or directory
Ошибка C1083 Не удается открыть файл включение: separate.h: No such file or directory Ошибка.
Не удается открыть файл включение: corectr.h No such file or directory
Всем привет. При попытке подключить cmath и компиляции проекта появляется такая ошибка, а.
Файл находится в другом проекте и в другом каталоге. Чтобы он был виден, поправьте настройки проекта (пути к заголовочным файлам)
Свойства -> Конфигурация Свойства -> C / C + + -> Общие -> Дополнительные каталоги включения -> $(ProjectDir)\D:\Прога2014\Прогапроба\Reshenie_loaded_ library\Debug\loaded_ library.dll
Как ему указать еще? Может я что-то лишнеевписал или наоборот не вписал?
Может конечно я опять что-то напутал
Добавлено через 1 минуту
Ошибка 1 error C1083: Не удается открыть файл включение: loaded_ library/Zagolovotsnyj_loaded_ library.h: No such file or directory d:\прога2014\прогапроба\reshenie_loaded_ library\dlltest\dlltest.cpp 6 1 DLLtest
2 IntelliSense: не удается открыть источник файл "loaded_ library/Zagolovotsnyj_loaded_ library.h" d:\прога2014\прогапроба\reshenie_loaded_ library\dlltest\dlltest.cpp 6 1 DLLtest
хм!! Спасибо!! Я же его мышью скопировал, из относительного пути. Щас разберусь.
Добавлено через 5 минут
Представляете, из свойств, из относительного пути- так и копируется. Это не ошибка.
Добавлено через 3 минуты
Да. А вот если я открываю папку с проектом в компе проводником, так там пробела нету!! как он образовывается, не знаю! Вот это да.
Добавлено через 25 секунд
Но не компилируется в двух вариантах.
Доброго утра!!Да я это видел. Пробел- это не ошибка. Я уже проект с пробелами не трогаю, а то будет тема как вернуть проект после переименования файлов.cpp b/h. Шучу конечно. Проект можно переписать минут за 20. Но пробел-не ошибка.
Нет, но поскольку он мало заметен, может стать причиной. Некоторые вещи просто нельзя пропускать в проект. В частности спецсимволы в именах файлов. Не говорю уже о транслите.
Открыл текстовым редактором файл DLLtest.vcxproj и что вижу
Свойства -> Конфигурация Свойства -> C / C + + -> Общие -> Дополнительные каталоги включения -> D:\Прога2014\Прогапроба\Reshenie_lo aded_ library\Debug\loaded_ library.dll
Я туда пробовал вписывать разное, почти с десятоквариатов, начиная от полного пути и по всякому. сечас у меня там
К стати, нашлись какие то т.н. Макросы, их довольно много. Кажется, я думаю, они-то как раз могут изменяться, если я перемещу решение в другое мкесто. Только скопировать я их не могу.
Макросы-сила. Кажется. это решение.
Error C1083: Не удается открыть файл включение: cube.h: No such file or directory
Ошибка довольно таки распространенная,но решения,к сожалению я так и не нашел. Вот собственно.
Fatal error C1083: Не удается открыть файл включение: stdafx.h: No such file or directory
Visual Studio c++ При запуске выдается ошибка fatal error C1083: Не удается открыть файл.
Compilation
------------------------
The bare lib depends only on the standard C/C++ library. If you want to see some action,
the small program stored in main.cpp depends on SDL.
Compilation is quite straightforward:
g++ -I./ main.cpp source/resource.cpp source/resource_image.cpp source/resource_string.cpp source/resource_tech.cpp source/resource_palette.cpp -I/usr/include/SDL -lSDL -o demo
You'll need to change the hardcoded path in main.cpp source file. And to run, demo need two numerical
parameters:
- first one is the index of the image inside the data file
- second one is the index of the palette used to render the image itself
g++ -I./ main.cpp source/resource.cpp source/resource_image.cpp source/resource_string.cpp source/resource_tech.cpp source/resource_palette.cpp -I/usr/include/SDL -lSDL -o demo
In file included from include/resource.h:1,
from main.cpp:1:
include/common.h:8: SDL.h: No such file or directory
In file included from include/resource.h:1,
from include/resource_string.h:1,
from main.cpp:2:
include/common.h:8: SDL.h: No such file or directory
In file included from include/resource.h:1,
from include/resource_image.h:1,
from main.cpp:3:
include/common.h:8: SDL.h: No such file or directory
In file included from include/resource.h:1,
from include/resource_palette.h:1,
from main.cpp:4:
include/common.h:8: SDL.h: No such file or directory
In file included from include/resource.h:1,
from include/resource_tech.h:1,
from main.cpp:5:
include/common.h:8: SDL.h: No such file or directory
In file included from .\include/resource.h:1,
from source/resource.cpp:1:
.\include/common.h:8: SDL.h: No such file or directory
In file included from .\include/resource.h:1,
from .\include/resource_image.h:1,
from source/resource.cpp:4:
.\include/common.h:8: SDL.h: No such file or directory
In file included from .\include/resource.h:1,
from .\include/resource_string.h:1,
from source/resource.cpp:5:
.\include/common.h:8: SDL.h: No such file or directory
In file included from .\include/resource.h:1,
from .\include/resource_palette.h:1,
from source/resource.cpp:6:
.\include/common.h:8: SDL.h: No such file or directory
In file included from .\include/resource.h:1,
from .\include/resource_tech.h:1,
from source/resource.cpp:7:
.\include/common.h:8: SDL.h: No such file or directory
In file included from .\include/resource.h:1,
from .\include/resource_image.h:1,
from source/resource_image.cpp:1:
.\include/common.h:8: SDL.h: No such file or directory
In file included from .\include/resource.h:1,
from .\include/resource_string.h:1,
from source/resource_string.cpp:1:
.\include/common.h:8: SDL.h: No such file or directory
In file included from .\include/resource.h:1,
from .\include/resource_tech.h:1,
from source/resource_tech.cpp:1:
.\include/common.h:8: SDL.h: No such file or directory
In file included from .\include/resource.h:1,
from .\include/resource_palette.h:1,
from source/resource_palette.cpp:1:
.\include/common.h:8: SDL.h: No such file or directory
Я так понимаю, что нужно изменить какой-то путь в main.cpp или добавить путь ко всей библиотеке SDL, но как именно это сделать я не могу разобраться. Подскажите, как скомпилировать этот проект без ошибок или в каком направлении двигаться - мне кажется, что решение простое, но я его не вижу, т.к. знаком с плюсами довольно поверхностно. Заранее благодарю.
Здесь все используемые мной ресурсы:
openpax-master.zip - чистый проект с гитхаба
SDL-devel-1.2.15-VC.zip - библиотека SDL
openpax-master.7z - так выглядит проект у меня на компьютере.
The file is not included in the include search path
this tells the compiler to look for the file in the same directory that contains the source file first, and then look in other locations specified by the build environment. If the quotation marks contain an absolute path, the compiler only looks for the file at that location. If the quotation marks contain a relative path, the compiler looks for the file in the directory relative to the source directory.
If the name is enclosed by angle brackets,
If your include files are in another directory relative to your source directory, and you use a relative path in your include directives, you must use double quotes instead of angle brackets. For example, if your header file myheader.h is in a subdirectory of your project sources named headers, then this example fails to find the file and causes C1083:
but this example works:
Возможно, файл заблокирован или используется
Если для изменения или доступа к файлу используется другая программа, файл может быть заблокирован. Попробуйте закрыть файл в другой программе. иногда другая программа может быть Visual Studio сама по себе при использовании параметров параллельной компиляции. Если отключить параметр параллельной сборки, то эта ошибка исчезнет, а это проблема. Эта проблема также может быть вызвана другими системами параллельной сборки. Будьте внимательны при задании зависимостей файлов и проектов, чтобы порядок сборки был правильным. В некоторых случаях рекомендуется создать промежуточный проект для принудительного создания последовательности зависимостей для общего файла, который может быть создан несколькими проектами. Иногда антивирусные программы временно блокируют недавно измененные файлы для проверки. Если возможно, рассмотрите возможность исключения каталогов сборки проекта из антивирусного сканера.
Файл находится в проекте, но не в пути поиска включаемых файлов
Чтобы устранить эту проблему, исправьте путь, используемый компилятором для поиска включаемого или импортируемого файла. В новом проекте используются пути поиска include по умолчанию. Может потребоваться изменить путь поиска include, чтобы добавить каталог для проекта. При компиляции в командной строке добавьте путь к переменной среды include или /I параметр компилятора, чтобы указать путь к файлу.
чтобы задать путь к каталогу включения в Visual Studio, откройте диалоговое окно страницы свойств проекта. выберите VC++ каталоги в разделе свойства конфигурации в левой области, а затем измените свойство включаемые каталоги . дополнительные сведения о каталогах для отдельных пользователей и проектов, поиск которых выполняется компилятором в Visual Studio, см. в разделе страница свойств VC++ directories. Дополнительные сведения о параметре компилятора см. в /I разделе /I (дополнительные каталоги включаемых данных).
Не задана среда командной строки INCLUDE или LIB
Если компилятор вызывается из командной строки, для указания путей поиска часто используются переменные среды. Если путь поиска, описанный в переменной среды include или lib , задан неправильно, может быть сформирована ошибка C1083. Мы настоятельно рекомендуем использовать ярлык командной строки разработчика, чтобы задать базовую среду для сборок с командной строкой. Дополнительные сведения см. в разделе сборка C/C++ в командной строке. Дополнительные сведения об использовании переменных среды см. в разделе инструкции. Использование переменных среды в сборке.
Читайте также: