I have a main function and I want to call another function inside my main,
but it gives me an error like this:
error C2601: 'ComputeCentroid' : local function definitions are illegal

I know that this is an error because the '{' for my main is still not closed before my ComputeCentroid function. right?

How can I fix this ? I cant call thsi function outside my main.
If I do, my declarations and pipelines will be missed up!

Hope you can help me .


You can't define a function inside another function. Move it outside.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.