在这个简单的cinder示例中(来自cinder introduction - http://libcinder.org/docs/v0.8.4/hello_cinder.html),我得到了这个编译错误:
myImage = gl::Texture( loadImage( loadResource( "image.jpg" ) ) );错误%1错误C2661:'cinder::app::App::loadResource‘:没有重载函数采用%1参数
然而,文档显示:
DataSourceRef cinder::app::loadResource ( const std::string & macPath )有什么想法吗?
发布于 2012-10-25 05:07:44
您是否指的是同一函数:
cinder::app::App::loadResoure
cinder::app::loadResource我从来没有用过这个库,但是doc说第一个函数需要更多的参数:
http://libcinder.org/docs/v0.8.4/classcinder_1_1app_1_1_app.html#afef905bb792960152d38c2680f88ea33
static DataSourceRef cinder::app::App::loadResource (
const std::string & macPath,
int mswID,
const std::string & mswType
) 发布于 2016-11-02 05:06:27
你最好试着加载为资源而不是资源:
gl::TextureRef texImagen;
texImagen = gl::Texture::create( loadImage( getAssetPath( "image.jpg" ) ) );assets文件夹中image.jpg所在的位置。资源是在运行时从此资源文件夹加载的。此文件夹可以与程序处于同一级别,也可以在最多三个级别以上。
资源位于资源文件夹中,在编译阶段复制并与应用程序或可执行文件打包在一起。
使用include the resources标头
#include "Resources.h"它包含如下内容
#pragma once
#include "cinder/CinderResources.h"
#define MY_IMAGE CINDER_RESOURCE( ../resources/, image.jpg, 1, IMAGE )然后,您可以加载它
texImagen = gl::Texture::create( loadResource( MY_IMAGE ) );请注意,如果您使用的是Xcode,则必须将图像添加到项目中,只需将其拖动到项目树中即可。
https://stackoverflow.com/questions/13057699
复制相似问题