Archived

This forum has been archived. Please start a new discussion on GitHub.

problems of sequence?

my ice file is defined as below, but when compiling, there are errors, why?
thks!

// **********************************************************************
//
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

#ifndef COMMON_M
#define COMMON_M

module Common
{
class CFuncMenu
{
string funcID;
string levelID;
string levelName;
string parentID;
string instanceName;
sequence<CFuncMenu> funcChildren;
};
};

#endif

Comments

  • benoit
    benoit Rennes, France
    Hi,

    You need to define the sequence first, for example:
    // Slice
    module Common
    {
    
    sequence<CFuncMenu> CFuncMenuSeq;
    
    class CFuncMenu
    {
        string funcID;
        string levelID;
        string levelName;
        string parentID;
        string instanceName;
        CFuncMenuSeq funcChildren;
    };
    
    }
    

    Cheers,
    Benoit.
  • there are still errors as blow:
    :/work/Projects/qta/Interface/Common.ice:15: `CFuncMenu' is not defined
    :/work/Projects/qta/Interface/Common.ice:24: `CFuncMenuSeq' is not defined
  • benoit
    benoit Rennes, France
    Sorry, you need to forward declare the CFuncMenu class for this to work. The following should work instead:
    // Slice
    module Common
    {
    
    class CFuncMenu;
    sequence<CFuncMenu> CFuncMenuSeq;
    
    class CFuncMenu
    {
        string funcID;
        string levelID;
        string levelName;
        string parentID;
        string instanceName;
        CFuncMenuSeq funcChildren;
    };
    
    };
    
  • thks very much, from this point of this, slice is very similar to c etc.

    thks again.