Get data from file(xxx.png) failed!

简介:

最近有很多朋友在群里问用VS+Cocos2d-x 加载图片资源时总是报“ Get data from file(xxx.png) failed!  ” 错误,问题虽小,但却能影响项目的往下进行,在一遍又一遍的检查后,还是没有什么发现,这着实让人抓狂哇~~~~(>_<)~~~~ 。下面我就来说说这是为什么以及如何解决这个问题吧:

原因一:

      在程序中的要引用的图片名字写错了~(低级错误^_^),解决方法我就不说了哈~

原因二:

     在VS 项目工程中,你所看到的Resource 路径只是一个虚拟路径,也就是如果你将图片直接添加到VS项目中的Resource,则这张图片是放在虚拟路径中,并不是项目路径下的Resource,不信你可以打开你项目的本地路径,在Resource文件夹下你会找不到刚才在VS的Resource下添加的图片。


原因二的解决方法:

   找到项目本地路径下的Resource,将项目所需要的图片直接copy到其中,然后在VS中将其添加到Resource,这时,问题就解决了!


图文:

1、


2、


3、














本文转蓬莱仙羽51CTO博客,原文链接:http://blog.51cto.com/dingxiaowei/1366388,如需转载请自行联系原作者

相关文章
|
C++
Get data from file(xxx.png) failed!
最近有很多朋友在群里问用VS+Cocos2d-x 加载图片资源时总是报“ Get data from file(xxx.png) failed!  ” 错误,问题虽小,但却能影响项目的往下进行,在一遍又一遍的检查后,还是没有什么发现,这着实让人抓狂哇~~~...
781 0
|
9月前
|
Shell
adb: error: cannot create file/directory ‘d:/1.png‘: No such file or directory
adb: error: cannot create file/directory ‘d:/1.png‘: No such file or directory
166 0
|
Unix Linux
Error copying image in the datastore: Not allowed to copy image file
opennebula error copying image in the datastore not allowed to copy image file Error copying image in the datastore: Not allowed to copy image file ...
1330 0
|
PHP
error: png.h not found.
执行php安装 --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-sessio
1251 0
|
Shell Linux
guestfish 修改 image file
Example guestfish sessionSometimes, you must modify a virtual machine image to remove any traces of the MAC addressthat was assigned to the virtual ne...
927 0
base64转图片的时候Can't read input file!
如果不去掉编码中的图片头信息,就会报Can't read input file!。 一开始还以为是文件路径格式有问题,然后看了看我之前用的,就有一个区别就是没有去头信息。

热门文章

最新文章