格式错误的字符(期望引用,得到了我)~正在处理 [英] Badly formed character (expecting quote, got I) ~ Processing

查看:129
本文介绍了格式错误的字符(期望引用,得到了我)~正在处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人能帮助我解决我的问题.我正在尝试制作一个简单的可视化来展示足球队如何在 2012 年的 FIFA 排名中上升或下降.为此,我创建了 17 个图像并将其加载到我的草图中,我想根据按钮事件移动这些图像.下面是我的代码:

I hope someone can help me with my problem. I'm trying to make a simple visualization to show how soccer teams either moved up or down in the FIFA rankings for 2012. To that I have created and loaded 17 images to my sketch which I want to move based on a button event. Below is my code:

//Setting up the images that will go into the sketch

PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage img7;
PImage img8;
PImage img9;
PImage img10;
PImage img11;
PImage img12;
PImage img13;
PImage img14;
PImage img15;
PImage img16;
PImage img17;

//loading the images from the file
void setup() {
  size(600, 1100)
  img1 = loadImage('Click.png');
  img2 = loadImage('Team_xxxxx.png');
  img3 = loadImage('Team_xxxxxx.png');
  img4 = loadImage('Team_xxxxxx.png');
  img5 = loadImage('Team_xxxxxxx.png');
  img6 = loadImage('Team_xxxxx.png');
  img7 = loadImage('Team_xxxxxx.png');
  img8 = loadImage('Team_xxxxxxx.png');
  img9 = loadImage('Team_xxxxxx.png');
  img10 = loadImage('Team_xxxxxx.png');
  img11 = loadImage('Team_xxxxx.png');
  img12 = loadImage('Team_xxxxx.png');
  img13 = loadImage('Team_xxxxx.png');
  img14 = loadImage('Team_xxxxxx.png');
  img15 = loadImage('Team_xxxxx.png');
  img16 = loadImage('Team_xxxxx.png');
  img17 = loadImage('Team_xxxxxx.png');
}

//Drawing the images into the sketch
void draw() {
  image(img1, 400, 100);
  image(img2, 100, 250);
  image(img3, 100, 300);
  image(img4, 100, 350);
  image(img5, 100, 400);
  image(img6, 100, 450);
  image(img7, 100, 500);
  image(img8, 100, 550);
  image(img9, 100, 600);
  image(img10, 100, 650);
  image(img11, 100, 700);
  image(img12, 100, 750);
  image(img13, 100, 800);
  image(img14, 100, 850);
  image(img15, 100, 900);
  image(img16, 100, 950);
  image(img17, 100, 1000);
}

我不断收到此错误消息:格式错误的字符(期望引用,得到了我).以下是控制台中的输出:

I keep getting this error message: Badly formed character (expecting quote, got I). And below is the output in the console:

 processing.app.SketchException: Badly formed character constant (expecting quote, got l)
        at processing.mode.java.preproc.PdePreprocessor.checkForUnterminatedMultilineComment(PdePreprocessor.java:478)
        at processing.mode.java.preproc.PdePreprocessor.write(PdePreprocessor.java:515)
        at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:270)
        at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:185)
        at processing.mode.java.JavaBuild.build(JavaBuild.java:144)
        at processing.mode.java.JavaBuild.build(JavaBuild.java:123)
        at processing.mode.java.JavaMode.handleRun(JavaMode.java:114)
        at processing.mode.java.JavaEditor$19.run(JavaEditor.java:474)
        at java.lang.Thread.run(Thread.java:680)

我在运行 OS X 的 Macbook Pro 上使用 Processing 2.0B7.

I'm using Processing 2.0B7 on a Macbook Pro running on OS X.

推荐答案

错误可能来自

img1 = loadImage('Click.png');

特别是 'Cl 位.字符常量由单引号 (')、某个字符和另一个单引号 (') 组成.
您拥有的是一个单引号 (')、一个 C,然后是一个 l.

specifically the 'Cl bit. Character constants consist of a single quote ('), some character, and another single quote (').
What you have is a single quote ('), a C, then an l.

因为你似乎想要一个字符串常量,试试双引号:

Since you seem to want a string constant instead, try double quotes:

img1 = loadImage("Click.png");

这篇关于格式错误的字符(期望引用,得到了我)~正在处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆