User forums > Using Code::Blocks

Problem with compiling

(1/1)

JimB121:
When I include the following code in my program it gives an error.

class particle{
     public:
            float size_x;
            float size_y;
            float size_z;
};
particle                  particle_v[100000000];
particle_v[1].size_x = 1;

This should work but for some reason it doesn't work in Code::Blocks.
the error is the following

error: expected constructor, destructor, or type conversion before '.' token

thanks in advance.

ollydbg:
Where did the error come from?
Compiler?

zabzonk:
Nothing to do with CB - it is not legal C++ code. Move the statement

 particle_v[1].size_x = 1;

into main() or some other function. And if you run it, be prepared for a stack overflow - once again, nothing to do with CB.

Jenna:

--- Quote from: zabzonk on May 30, 2009, 09:55:14 am ---once again, nothing to do with CB.

--- End quote ---

Therefore violating our forum rules.

Topic locked !!!

Navigation

[0] Message Index

Go to full version