Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/161.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
Haxe,OpenFL android调试在cpp中给出错误_Android_C++_Flash_Haxe_Openfl - Fatal编程技术网

Haxe,OpenFL android调试在cpp中给出错误

Haxe,OpenFL android调试在cpp中给出错误,android,c++,flash,haxe,openfl,Android,C++,Flash,Haxe,Openfl,我正在使用Haxe和OpenFl在FlashDevelop中开发一个应用程序 当我在flash target中测试我的应用程序时,它运行良好。但当我为android编译时,在编译过程中会出现以下错误: ./src/ReaderView2.cpp: In member function 'virtual Void ReaderView2_obj::setZoom()': ./src/ReaderView2.cpp:653: error: base operand of '->' has no

我正在使用Haxe和OpenFl在FlashDevelop中开发一个应用程序

当我在flash target中测试我的应用程序时,它运行良好。但当我为android编译时,在编译过程中会出现以下错误:

./src/ReaderView2.cpp: In member function 'virtual Void ReaderView2_obj::setZoom()':
./src/ReaderView2.cpp:653: error: base operand of '->' has non-pointer type 'String'
Build halted with errors (haxelib.exe).
…这显然与cpp有关,我不是一个真正的专家

有人知道错误的意思吗

下面是setzoom函数:(整个文件相当大)

公共函数setZoom()
{
隐藏();
while(numChildren>0)
{
Main.remove(getChildAt(0));
}
if(image!=null)if(image.parent!=null)image.parent.removeChild(image);
images=新数组();
field=新的TextField();
var fieldFont=Assets.getFont(“font/Kreon Regular.ttf”);
变量格式:TextFormat=新的TextFormat(fieldFont.fontName,currentZoom,0x4f4f);
format.align=TextFormatAlign.LEFT;
field.defaultTextFormat=格式;
field.embeddeFonts=true;
field.text=全文;
field.selective=false;
field.wordWrap=true;
field.border=false;
field.autoSize=TextFieldAutoSize.LEFT;
field.width=显示宽度;
//字段x=0;
//将字符串拆分为单词
var allpars:Array=fullText.split(“\r\n”);
变量字:数组;
变量字段:数组=新数组();
var tempField:TextField=null;
var contentHeight:Float=displayHeight;
var-wordI:Int;
var paraI:Int=0;
var-tempArr2:数组;
while(paraI<所有段落长度)
{
if(false)//检查img标签
{
}
else//如果para是单词
{
wordI=0;
words=所有段落[paraI]。拆分(“”);
while(wordIcontentHeight)
{
if(tempField!=null){
字一;
tempArr2=tempField.text.toString().split(“”);
用于(0…tempArr2.长度中的i)
{
tempArr2.删除(“”);
}
tempArr2.pop();
tempField.text=tempArr2.join(“”);
}
tempField=newtextfield();
tempField.defaultTextFormat=field.getTextFormat();
tempField.embedFonts=true;
tempField.text=“”;
tempField.border=false;
tempField.selective=false;
tempField.wordWrap=true;
tempField.autoSize=TextFieldAutoSize.LEFT;
tempField.width=displayWidth-2;
tempField.x=0;
fields.push(tempField);
}
其他的
{
tempField.appendText(words[wordI]+(wordI==words.length-1?\n:“);
wordI++;
}
}
}
paraI++;
}
var-bd:BitmapData;
用于(0…字段中的i。长度)
{
bd=新位图数据(Std.int(字段[i].宽度),Std.int(字段[i].高度));
bd.draw(字段[i]);
push(新位图(bd,PixelSnapping.AUTO,true));
}
//addChild(字段[0]);
图像[0].x=10;
addChild(图像[0]);
currentPageInstance=图像[0];
currentPage=0;
drawScrollBar();
如果(optionsBtn!=null)addChild(optionsBtn);
}

显然,使用toString()函数会给cpp目标带来问题。

您的项目中有文件名“ReaderView2.hx”吗?@lordkryss是的,我认为我们需要该文件来帮助您,可能还有cpp文件的ReaderView2_obj::setZoom(),另外,请确保具有最新版本的openfl和hxcpp@lordkryss我有所有图书馆中最新的
public function setZoom()
{
    hideOptions();

    while (numChildren > 0)
    {
        Main.remove(getChildAt(0));
    }

    if (image != null) if (image.parent != null) image.parent.removeChild(image);

    images = new Array();

    field = new TextField();
    var fieldFont = Assets.getFont("fonts/Kreon-Regular.ttf");
    var format:TextFormat = new TextFormat(fieldFont.fontName, currentZoom, 0x4F4F4F);

    format.align = TextFormatAlign.LEFT;
    field.defaultTextFormat = format;

    field.embedFonts = true;
    field.text = fullText;
    field.selectable = false;
    field.wordWrap = true;
    field.border = false;
    field.autoSize = TextFieldAutoSize.LEFT;
    field.width = displayWidth;
    //field.x = 0;

    //split string into words
    var allParas:Array<String> = fullText.split("\r\n");
    var words:Array<String>;
    var fields:Array<TextField> = new Array();
    var tempField:TextField = null;
    var contentHeight:Float = displayHeight;
    var wordI:Int;
    var paraI:Int = 0;
    var tempArr2:Array<String>;

    while (paraI < allParas.length)
    {
        if (false) //check img tag
        {

        }
        else //if para is words
        {
            wordI = 0;
            words = allParas[paraI].split(" ");

            while (wordI < words.length)
            {
                if (tempField == null || tempField.textHeight > contentHeight)
                {
                    if (tempField != null) {
                        wordI--;
                        tempArr2 = tempField.text.toString().split(" ");


                        for (i in 0... tempArr2.length)
                        {
                            tempArr2.remove("");

                        }

                        tempArr2.pop(); 
                        tempField.text = tempArr2.join(" ");
                    }

                    tempField = new TextField();
                    tempField.defaultTextFormat = field.getTextFormat();
                    tempField.embedFonts = true;
                    tempField.text = "";
                    tempField.border = false;
                    tempField.selectable = false;
                    tempField.wordWrap = true;
                    tempField.autoSize = TextFieldAutoSize.LEFT;
                    tempField.width = displayWidth-2;
                    tempField.x = 0;
                    fields.push(tempField);
                }
                else 
                {
                    tempField.appendText(words[wordI] + (wordI == words.length - 1? "\n": " "));
                    wordI++;
                }
            }
        }
        paraI++;
    }

    var bd:BitmapData;

    for (i in 0... fields.length)
    {
        bd = new BitmapData(Std.int(fields[i].width), Std.int(fields[i].height));
        bd.draw(fields[i]);
        images.push(new Bitmap(bd, PixelSnapping.AUTO, true));

    }

    //addChild(fields[0]);
    images[0].x = 10;
    addChild(images[0]);
    currentPageInstance = images[0];
    currentPage = 0;

    drawScrollBar();
    if (optionsBtn!=null)addChild(optionsBtn);
}