Can't create PDF

edited January 2016 in Using Processing

Hello everyone,

I'm new here and totally new to processing. I hope someone can tell me what I'm doing wrong. When I try to export a PDF file it won't work.

I get the error: Duplicate method setup()in type sketch_……

I hope that someone can help me. Because processing is new to me forums won't help me much so far.

1 2

Tagged:

Answers

  • Well, the error pretty much says it all. Why do you have two setup() functions? Why is your import statement in the middle of your code?

  • Thanks for your reply Kevin. I'm working with the book: Type + Code. The first code is the part from what I want to create. The second code, where the second setup() function comes in is the part where I want to export the file to a PDF. Can you try to explain what the right place is for the import statement? Sorry if my question seems so obvious.

  • This looks like two different pieces of code, which means you should probably have them in separate windows. Since you have two setup() functions, Processing has no idea which one to call, so it gives you that error.

    Import statements go at the very top of your code. It looks like you simply copied a second program at the end of an existing program, which won't work. Each program needs to be in its own sketch.

  • Or, you need to merge the two programs.

    ...

    I tried to show, but you shown an image instead of textual code, so I can't copy & paste code! Bad idea...

    But, basically, move the import statement to the beginning, replace the first size() statement by the second one, and get rid of the second setup() and the draw() function.

    You can add exit() at the end of the setup().

Sign In or Register to comment.