Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/164.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ sfml sf::Image()类问题_C++_Xcode_Image_Shared Libraries_Sfml - Fatal编程技术网

C++ sfml sf::Image()类问题

C++ sfml sf::Image()类问题,c++,xcode,image,shared-libraries,sfml,C++,Xcode,Image,Shared Libraries,Sfml,因此,我在构建的一个XCode项目中使用了sfml框架,并且在使用sf::Image()类时遇到了一些问题 有些函数工作得很好,正如预期的那样,但其他函数会给出编译器错误 例如,我可以在没有错误的情况下执行以下操作,它将打印正确的结果: sf::Image *image = new sf::Image(600,600); int width = image->GetWidth(); int height = image->GetHeight(); std::cout<<w

因此,我在构建的一个XCode项目中使用了sfml框架,并且在使用sf::Image()类时遇到了一些问题

有些函数工作得很好,正如预期的那样,但其他函数会给出编译器错误

例如,我可以在没有错误的情况下执行以下操作,它将打印正确的结果:

sf::Image *image = new sf::Image(600,600);
int width = image->GetWidth();
int height = image->GetHeight();
std::cout<<width<<" "<<height<<std::endl;

我感谢所有的帮助

调试目录中的EXE之外还有SFML dll吗

在我自己的项目中,有3个来自SFML的dll,它们是:

  • sfml-graphics-2.dll
  • sfml-system-2.dll
  • sfml-window-2.dll
可以在SFML Bin目录中找到。另外,不要忘记将SFML>libdir添加到项目的库搜索路径中。同样,不要忘记使用适当的库:

  • sfml图形
  • sfml窗口
  • sfml系统
  • opengl32

您是否尝试过使用image.SaveToFile(文件名)查看是否有效?请升级到2.0。SFML 1.x版本都已弃用。
std::string filename = "myfile.jpg";
sf::Image *image = new sf::Image(600,600);
image->SaveToFile(filename);