Porting CC to GCC

R

Ryan Liu

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
 
V

Victor Bazarov

Ryan Liu said:
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
 
R

Ryan Liu

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
 
C

Clark Cox

Ryan Liu said:
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.
 
C

Clark Cox

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.[/QUOTE]

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".
 
L

lilburne

Clark said:
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".
[/QUOTE]

Or change SeqNumSet::instance() to be:

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

return m_instance;
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top