Particle tutorial error

Hi, I’m trying to learn from the particle tutorial, http://wiki.openframeworks.cc/index.php-…-cle-system , but I’m getting the following error when I try to build the code:

error: ISO C++ forbids declaration of Particle' with no type error: expected;’ before ‘*’ token
error: expected `;’ before “int”

:slight_smile:

the code looks like this, with the error on the first line:

  
  
Particle* create() {  
_ncreated += 1;  
return new Particle(_x, _y, _x_velocity, _y_velocity, _r, _g, _b);  
}  
  

If someone could help me with this, that would be awesome!

You have to define the particle class first.

ding, thank you so much for taking the time to help me out here!

I did define the class… but it’s defined under the class that the code I showed you is in.

I changed the particle and source class around, and then I got a whole bunch of other errors… switched around some more stuff in the .ccp file and now i get 41 errors, with all kinds of different errors:

  
error: no `void testApp::create_particles()' member function declared in class `testApp'  
In member function `void testApp::create_particles()':  
error: `list' was not declared in this scope  
  
... 39 more errors ...  
  
  

Is it actually useful to try and figure this out, or should I just start on a somewhat simpler code?

It sounds like alot of bad c++ grammar on your part. If you post much more code than maybe I or others can help.

[edit] dont be afraid to post some not so good code. It’s friendly around here.

there is some sample particle system code here, which might be a helpful alternative –

http://www.makingthingsmove.org/blog/?cat=5

it’s a different style then the code on the tutorial, but it’s fairly useful.

you can take the code from any of the days (day 5 and day 6 have particle code) and you must add all of the src code to an OF project (and use the vectorMath addon example as a base, since the particles use the vector math addon*). be sure to include all the .h and .cpp files for all targets.

* there is one example that uses opencv addon too, so you’ll need to base that off the all addons example.

take care!!
zach

I also attempted to assemble this example and ended up in a similar position. Does anyone have a more put-together version so that I can see what exactly is wrong with our setupz?

thanks!

yes, so the only thing I did with the particle tutorial is paste it in the OF example app… and then all the errors got pooped out by the debugger…
I added nothing else.

I will try the other particle system posted by zach…

I realize this is 18 months later, but if anyone else is looking for the solution to this:

Adding

  
#include "Particle.h"  

to the top of your Source.h file will fix this issue.

:slight_smile:
Sometimes the solution can be easy…
As I am a beginner and trying to learn C++ I struggle all the time over small mistakes.
Is the tutorial corrected at all?

Well, not sure about the wiki tutorial. I kept going and had some issues that I wasn’t able to fix.

I did find this tutorial from Stephen Braitsch:

http://www.quietless.com/kitchen/gettin-…-rameworks/

I’m an AS3 guy coming to oF, so this was hugely helpful.

Cheers,

gabi