Porting CC to GCC

Discussion in 'C++' started by Ryan Liu, Feb 22, 2004.

  1. Ryan Liu

    Ryan Liu Guest

    Hi All,

    Now I am porting CC to GCC and I have some problems.
    Would you mind tell me some document which have some description how to port
    CC to GCC ??

    Thank you very much.
    Ryan
    Ryan Liu, Feb 22, 2004
    #1
    1. Advertising

  2. "Ryan Liu" <> wrote...
    > Now I am porting CC to GCC and I have some problems.
    > Would you mind tell me some document which have some description how to

    port
    > CC to GCC ??


    I am not aware of any document for such porting, but if you have
    problems with the code, why not post them/it here? We can help,
    or direct you to a better newsgroup (depending on the problem).

    Victor
    Victor Bazarov, Feb 22, 2004
    #2
    1. Advertising

  3. Ryan Liu

    Ryan Liu Guest

    Thank you very much for your help.

    The problems is following.

    Complier:
    Gcc Version 2.8.1
    OS:
    Solaris 2.6

    Part Source Code:

    class SeqNumSet //: public VIRTUAL Object
    {
    // DECLARE_MEMBERS(SeqNumSet);
    public:
    ~SeqNumSet();


    static SeqNumSet& instance()
    {
    if (m_instance.get() == 0)
    {
    // auto_ptr can only be changed by assignment from another auto_ptr
    auto_ptr<SeqNumSet> tmp(new SeqNumSet);
    m_instance = tmp;
    }
    return *(m_instance.get());
    }

    protected: // storer() functions for Object I/O
    SeqNum &getSeqNum(int link, int uniqueTag);
    const SeqNum &getSeqNum(int link, int uniqueTag) const;

    private:
    SeqNumSet(); // Singleton constructor must be private
    SeqNumSet(const SeqNumSet& other); // defined but not implemented, so any
    attempts to copy are stopped
    SeqNumSet& operator =(SeqNumSet& other); // ditto

    Dictionary sets; // From IntegerCache linkNum -> Dictionary(
    // IC(uniqueTag) -> new SeqNum
    //static auto_ptr<SeqNumSet> m_instance;
    static auto_ptr<SeqNumSet> m_instance;
    };

    Error Message:
    warning: ANSI C++ forbids declaration `auto_ptr' with no type
    parse error before `;'
    warning: `class SeqNumSet' only defines private constructors and has no
    friends
    In function `static class SeqNumSet & SeqNumSet::instance()':
    (Each undeclared identifier is reported only once
    for each function it appears in.)
    `auto_ptr' undeclared (first use this function)
    parse error before `>'
    confused by earlier errors, bailing out

    I don't know why it has this error when I porting CC to GCC.
    I think the problems is the line:
    static auto_ptr<SeqNumSet> m_instance;
    Cound you mind giving some suggestion how to fix this error?

    I am very appreciated for your help.

    Ryan


    "Victor Bazarov" <> wrote in message
    news:kT6_b.376225$xy6.1944214@attbi_s02...
    > "Ryan Liu" <> wrote...
    > > Now I am porting CC to GCC and I have some problems.
    > > Would you mind tell me some document which have some description how to

    > port
    > > CC to GCC ??

    >
    > I am not aware of any document for such porting, but if you have
    > problems with the code, why not post them/it here? We can help,
    > or direct you to a better newsgroup (depending on the problem).
    >
    > Victor
    >
    >
    Ryan Liu, Feb 22, 2004
    #3
  4. Ryan Liu

    Clark Cox Guest

    In article <c1at84$>,
    "Ryan Liu" <> wrote:

    > Hi All,
    >
    > Now I am porting CC to GCC and I have some problems.
    > Would you mind tell me some document which have some description how to port
    > CC to GCC ??


    That depends heavily on several things. You might want to post some of
    small part of the actual code that your are having trouble with, along
    with what your actual problems are.
    Clark Cox, Feb 22, 2004
    #4
  5. Ryan Liu

    Clark Cox Guest

    In article <c1auc6$>, "Ryan Liu" <> wrote:

    [snip]
    > Error Message:
    > warning: ANSI C++ forbids declaration `auto_ptr' with no type
    > parse error before `;'
    > warning: `class SeqNumSet' only defines private constructors and has no
    > friends
    > In function `static class SeqNumSet & SeqNumSet::instance()':
    > (Each undeclared identifier is reported only once
    > for each function it appears in.)
    > `auto_ptr' undeclared (first use this function)
    > parse error before `>'
    > confused by earlier errors, bailing out
    >

    [snip]
    > I am very appreciated for your help.


    Make sure that you've included <memory> somewhere earlier in the
    code, and change all of the occurrences of "auto_ptr" to "std::auto_ptr".
    Clark Cox, Feb 22, 2004
    #5
  6. Ryan Liu

    lilburne Guest

    Clark Cox wrote:
    > In article <c1auc6$>, "Ryan Liu" <> wrote:
    >
    > [snip]
    >
    >>Error Message:
    >>warning: ANSI C++ forbids declaration `auto_ptr' with no type
    >>parse error before `;'
    >>warning: `class SeqNumSet' only defines private constructors and has no
    >>friends
    >>In function `static class SeqNumSet & SeqNumSet::instance()':
    >>(Each undeclared identifier is reported only once
    >>for each function it appears in.)
    >>`auto_ptr' undeclared (first use this function)
    >> parse error before `>'
    >>confused by earlier errors, bailing out
    >>

    >
    > [snip]
    >
    >>I am very appreciated for your help.

    >
    >
    > Make sure that you've included <memory> somewhere earlier in the
    > code, and change all of the occurrences of "auto_ptr" to "std::auto_ptr".
    >


    Or change SeqNumSet::instance() to be:

    SeqNumSet& SeqNumSet::instance()
    {
    static SeqNumSet m_instance;

    return m_instance;
    }
    lilburne, Feb 23, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    413
  2. Kevin P. Fleming

    C99 structure initialization in gcc-2.95.3 vs gcc-3.3.1

    Kevin P. Fleming, Nov 6, 2003, in forum: C Programming
    Replies:
    2
    Views:
    630
    Kevin P. Fleming
    Nov 6, 2003
  3. Replies:
    5
    Views:
    350
    Nathan Addy
    Sep 17, 2005
  4. Frank Steinmetzger
    Replies:
    2
    Views:
    353
    Frank Steinmetzger
    Mar 29, 2008
  5. ashnin

    GCC 3.4.3 and GCC 4.1.2

    ashnin, Jul 7, 2008, in forum: C++
    Replies:
    1
    Views:
    501
    Michael DOUBEZ
    Jul 7, 2008
Loading...

Share This Page