没有加载库,原因是没有找到图像
dyld: Library not loaded...reason image not found?
我是c++和XCode的新手,我使用sdl2
来创建一个窗口,但当我编译它时,它会崩溃,给我一个线程。我已经包括了opengl.h
, stdio.h
和SDL2.h
。有关于
dlyd:库未加载,但它们不同。
错误信息:
dyld: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2/用户/shayanrazavi/图书馆/开发/Xcode/DerivedData/c++ _code-bbdyozxqxxdxosbxuyhcrqobxrkd/构建/产品/调试/c++代码
原因:没有找到图像
这是我使用的代码,我不能得到int main的代码块内的某些原因,但无论如何,我从https://wiki.libsdl.org/SDL_CreateWindow得到这段代码。
int main(int argc, char* argv[]) {
SDL_Window *window; // Declare a pointer
SDL_Init(SDL_INIT_VIDEO); // Initialize SDL2
// Create an application window with the following settings:
window = SDL_CreateWindow(
"An SDL2 window", // window title
SDL_WINDOWPOS_UNDEFINED, // initial x position
SDL_WINDOWPOS_UNDEFINED, // initial y position
640, // width, in pixels
480, // height, in pixels
SDL_WINDOW_OPENGL // flags - see below
);
// Check that the window was successfully made
if (window == NULL) {
// In the event that the window could not be made...
printf("Could not create window: %sn", SDL_GetError());
return 1;
}
// The window is open: enter program loop (see SDL_PollEvent)
SDL_Delay(3000); // Pause execution for 3000 milliseconds, for example
// Close and destroy the window
SDL_DestroyWindow(window);
// Clean up
SDL_Quit();
return 0;
}
我明白了为什么会发生这种情况,我本来打算把框架放在/Library/Frameworks
文件夹中,然后在XCode中使用它,因为当你下载SDL时,它会给你一个read me文件,read me文件说要把它放在那个文件夹中。
我想下次我应该试着阅读我文件中的所有文本。但如果我尝试在XCode中运行它会因为某些原因崩溃。(有意义,因为它说dyld: Library not loaded and we just put it in /Library/Frameworks
)
相关文章:
- 无法将图像加载到纹理矢量 (SFML)
- 如何将硬编码图像加载到 OpenGL 纹理中
- C++ SDL2 图像加载格式与.bmp不同
- 土壤图像加载库参数
- 示例文件中的CImg图像加载错误
- OpenGL图像加载64位深度
- SFML图像加载在发布版本上失败 - 文件名损坏
- 如何将图像加载到painter.drawimage函数
- 将图像加载到Mat-vvector<向量<垫子>>
- OpenCV图像加载程序退出
- 从字节数组将图像加载到图形视图中
- 将图像加载到现有Mat中
- 处理文件和图像加载异常的最佳方法是什么?
- 将PNG或JPG图像加载到CMFCToolBarImages中
- stb图像加载库返回白色纹理
- 创建垫子后,从字节向量将图像加载到垫子上
- 图像加载功能不工作
- 将UTF-16图像加载到内存中
- 我怎么能得到像素的颜色在我的图像(加载灰色)
- 正在将位图图像加载到按钮