We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › how to include source code
Page Index Toggle Pages: 1
how to include source code (Read 187 times)
how to include source code
Oct 25th, 2008, 3:20am
 
Please excuse noob question, but I need to know how to include a source file into another. For example I have this simple program:

int myVar;

void setVar() {
 myVar = 10;
}

void setup() {
 setVar();
 println(myVar);
}

And I would like to move the variable declaration and first function into another file. So the result will be:

** file mylib.txt: **
int myVar;

void setVar() {
 myVar = 10;
}

and
** file myprog.pde: **
__some include statement__

void setup() {
 setVar();
 println(myVar);
}

thanks
Re: how to include source code
Reply #1 - Oct 25th, 2008, 7:37am
 
Holly cow! Sorry for that stupid question !
I just noticed that I have to add .pde extension to the library file and save in the same directory - then Processing will take care of including that file into the project. I love this programming language! So intuitive.
Page Index Toggle Pages: 1