致命错误:sdl。h:没有这样的文件或目录。

时间:2022-05-11 22:55:45

I'm having some issues getting a CHIP-8 interpreter to compile. Upon pressing ctrl+f9 to compile I am met by a message saying "Build ended with errors. Continue?".

我有一些问题需要一个芯片编译器来编译。在按下ctrl+f9编译后,我收到一条消息,说“构建以错误结束”。继续吗?”

Checking the build log reveals the following error: C:/Workspace/****/****/main.c:4:17: fatal error: sdl.h: No such file or directory

检查构建日志会发现以下错误:C:/Workspace/****/** /main。c:4:17,致命错误:sdl。h:没有这样的文件或目录。

I have tried copying SDL.h into the source directory, that did not work.

我试过复制SDL。h进入源目录,这不起作用。

I tried making a directory in source called "SDL" (src/SDL/SDL.h), did not work.

我尝试在源代码中创建一个名为SDL的目录(src/SDL/SDL.h),但是没有工作。

I also tried making a folder next to src, (SDL/SDL.h). That did not work either.

我还试着在src旁边做一个文件夹(SDL/SDL.h)。这也没有用。

After that I tried #include <.SDL.h>, #include <.sdl.h>, #include <.SDL.dll> and #include <.sdl.dll> (ignore the period after the "<" symbol)

在那之后,我尝试了包括<. sdl。h > # include < .sdl。h > # include < .SDL。dll >和# include < .sdl。dll>(忽略“<”符号后的时间)

I have also tried copying over the files for SDL version 1.2.15 and SDL version 2.0.3. That did work either.

我还尝试过复制SDL 1.2.15和SDL 2.0.3版本的文件。所做的工作。

Am I doing something fundamentally wrong? How do I get this to compile?

我是不是做错了什么?如何让它编译?

2 个解决方案

#1


1  

You have to say your compiler where sdl.h lives, with -I/path/to/sdl switch on gcc or filling Include Path in msvc

你必须说你的编译器,sdl。h生活,用i /path/to/sdl开关在gcc或填充中包括msvc中的路径。

(don't move it, as it (sdl.h) will probably needs other header files)

(不要移动它,因为它(sdl.h)可能需要其他头文件)

#2


1  

Here's a step-by-step on how to get SDL1.2.5 working with codelite:

以下是如何让SDL1.2.5与codelite合作的步骤:

  1. Download the "Development Libraries" from here
  2. 从这里下载“开发库”。
  3. Extract the tar.gz file contents to a directory. For eg: C:\mysdl
  4. 提取焦油。gz文件内容到一个目录。例如:C:\ mysdl
  5. In codelite, right-click over the project's name in the "Workspace View"
  6. 在codelite中,在“Workspace View”中右键单击项目名称
  7. From the context menu, select "Settings..."
  8. 从上下文菜单中选择“设置…”
  9. The 'Project Settings' dialog will appear.
  10. “项目设置”对话框将会出现。
  11. In the "configuration Type" choose "Debug" or "Release", based on your requirements. You can also, do the following steps for both Debug and Release.
    • Go to "Compiler" tab
      • In "Additional Search Path", add the path where all the sdl include files are. For eg: C:\mysdl\include
      • 在“附加搜索路径”中,添加所有sdl包含文件的路径。例如:C:\ mysdl \包括
    • 转到“附加搜索路径”中的“编译器”选项卡,添加所有sdl包含文件的路径。例如:C:\ mysdl \包括
    • Go to "Linker" tab
      • In "Library Path", add you lib path eg: C:\mysdl\lib\
      • 在“库路径”中,添加您的lib路径,如:C:\mysdl\lib\。
      • In the "Options" append -lSDL -lSDLmain -lmingw32 -mwindows(case-matters)
      • 在“选项”中,append -lSDL -lSDLmain -lmingw32 -mwindows(case-matters)
    • 在“库路径”中切换到“链接器”选项卡,在“选项”中添加“选项”-lSDL -lSDLmain -lmingw32 -mwindows(case-matters)。
  12. 在“配置类型”中,根据您的需求选择“调试”或“发布”。您还可以为调试和发布执行以下步骤。转到“附加搜索路径”中的“编译器”选项卡,添加所有sdl包含文件的路径。例如:\mysdl\包括到“Library Path”中的“Linker”选项卡,添加你的lib路径,如:C:\mysdl\lib\在“选项”中添加-lSDL -lSDLmain -lmingw32 -mwindows(case-matters)
  13. Copy C:\mysdl\bin\SDL.dll to C:\WINDOWS\SYSTEM32 or if 64-bit C:\Windows\SysWOW64
  14. 将C:\ mysdl \ bin \ SDL。在windowssystem32或64位的c:) windowssyswow64中。
  15. When including headers you must use #include "SDL\SDL.h" or #include "SDL.h" depending on how you configure your directory structure.
  16. 当包含header时,必须使用#include“SDL\SDL”。SDL h”或# include”。h“取决于您如何配置目录结构。

#1


1  

You have to say your compiler where sdl.h lives, with -I/path/to/sdl switch on gcc or filling Include Path in msvc

你必须说你的编译器,sdl。h生活,用i /path/to/sdl开关在gcc或填充中包括msvc中的路径。

(don't move it, as it (sdl.h) will probably needs other header files)

(不要移动它,因为它(sdl.h)可能需要其他头文件)

#2


1  

Here's a step-by-step on how to get SDL1.2.5 working with codelite:

以下是如何让SDL1.2.5与codelite合作的步骤:

  1. Download the "Development Libraries" from here
  2. 从这里下载“开发库”。
  3. Extract the tar.gz file contents to a directory. For eg: C:\mysdl
  4. 提取焦油。gz文件内容到一个目录。例如:C:\ mysdl
  5. In codelite, right-click over the project's name in the "Workspace View"
  6. 在codelite中,在“Workspace View”中右键单击项目名称
  7. From the context menu, select "Settings..."
  8. 从上下文菜单中选择“设置…”
  9. The 'Project Settings' dialog will appear.
  10. “项目设置”对话框将会出现。
  11. In the "configuration Type" choose "Debug" or "Release", based on your requirements. You can also, do the following steps for both Debug and Release.
    • Go to "Compiler" tab
      • In "Additional Search Path", add the path where all the sdl include files are. For eg: C:\mysdl\include
      • 在“附加搜索路径”中,添加所有sdl包含文件的路径。例如:C:\ mysdl \包括
    • 转到“附加搜索路径”中的“编译器”选项卡,添加所有sdl包含文件的路径。例如:C:\ mysdl \包括
    • Go to "Linker" tab
      • In "Library Path", add you lib path eg: C:\mysdl\lib\
      • 在“库路径”中,添加您的lib路径,如:C:\mysdl\lib\。
      • In the "Options" append -lSDL -lSDLmain -lmingw32 -mwindows(case-matters)
      • 在“选项”中,append -lSDL -lSDLmain -lmingw32 -mwindows(case-matters)
    • 在“库路径”中切换到“链接器”选项卡,在“选项”中添加“选项”-lSDL -lSDLmain -lmingw32 -mwindows(case-matters)。
  12. 在“配置类型”中,根据您的需求选择“调试”或“发布”。您还可以为调试和发布执行以下步骤。转到“附加搜索路径”中的“编译器”选项卡,添加所有sdl包含文件的路径。例如:\mysdl\包括到“Library Path”中的“Linker”选项卡,添加你的lib路径,如:C:\mysdl\lib\在“选项”中添加-lSDL -lSDLmain -lmingw32 -mwindows(case-matters)
  13. Copy C:\mysdl\bin\SDL.dll to C:\WINDOWS\SYSTEM32 or if 64-bit C:\Windows\SysWOW64
  14. 将C:\ mysdl \ bin \ SDL。在windowssystem32或64位的c:) windowssyswow64中。
  15. When including headers you must use #include "SDL\SDL.h" or #include "SDL.h" depending on how you configure your directory structure.
  16. 当包含header时,必须使用#include“SDL\SDL”。SDL h”或# include”。h“取决于您如何配置目录结构。