How to export each object using c++ api?

You need to clarify what you mean by “object”. As @DanRathbun has pointed out, SketchUp has geometric primitives and isolated collections of them (groups and components) but it has no larger or more structured notion of “object”. So, what does it mean to export an object?

Perhaps what you are looking for is an SDK equivalent to the GUI’s triple-click or context menu Select->all connected and the Ruby API’s #all_connected methods on Edge and Face Entities. These recursively find all the Entities that share geometry with the starting Entity and anything it touches. They will gather in everything that is not spatially isolated from the argument or in a different Entities collection (group or component). This is as close as SketchUp has to a notion of non-primitive “object”.

Alas, so far as I can tell (@DanRathbun please correct me if I’m wrong) the C/C++ SDK has no such pre-written method. If you want such, you are expected to write it yourself using the sorts of functions Dan listed to follow the links between touching entities.