C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Implementation Files & C++

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Will Oram
Guest





PostPosted: Tue Sep 30, 2003 12:30 am    Post subject: Implementation Files & C++ Reply with quote



Normally I use PB for Cocoa, but now I'm using it for a school project.
I have an implementation file, a header, and a main cpp file.

I have a class defined in the header, which I will simplify to the
basics for viewing audiences:

class SomeClass {
public:
SomeClass(); //constructor
};

...with function members defined in the implementation:

SomeClass::SomeClass() {
cout << "hellon";
}

Trouble is, PB complains that I've already defined SomeClass elsewhere.
It doesn't *show* me where, though.

I've tried this in CodeWarrior too, with similar complaints. Now I'm
thinking it's my fault and not a compiler quirk. But I essentially
copied the above out of my textbook!

Any thoughts? Thanks.


Back to top
Attila Feher
Guest





PostPosted: Tue Sep 30, 2003 7:25 am    Post subject: Re: Implementation Files & C++ Reply with quote



Will Oram wrote:
[SNIP]
Quote:
Trouble is, PB complains that I've already defined SomeClass
elsewhere. It doesn't *show* me where, though.

I've tried this in CodeWarrior too, with similar complaints. Now I'm
thinking it's my fault and not a compiler quirk. But I essentially
copied the above out of my textbook!

Any thoughts? Thanks.

I have no idea what PB is, but what I am sure about is that you need to post
a minimal, compilable code what shows your problem. With this information
we could only guess.

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8

--
Attila aka WW



Back to top
Howard
Guest





PostPosted: Tue Sep 30, 2003 4:11 pm    Post subject: Re: Implementation Files & C++ Reply with quote



Quote:
Normally I use PB for Cocoa, but now I'm using it for a school project.
I have an implementation file, a header, and a main cpp file.

I have a class defined in the header, which I will simplify to the
basics for viewing audiences:

class SomeClass {
public:
SomeClass(); //constructor
};

..with function members defined in the implementation:

SomeClass::SomeClass() {
cout << "hellon";
}

Trouble is, PB complains that I've already defined SomeClass elsewhere.
It doesn't *show* me where, though.

I've tried this in CodeWarrior too, with similar complaints. Now I'm
thinking it's my fault and not a compiler quirk. But I essentially
copied the above out of my textbook!

Any thoughts? Thanks.

What do your #include's look like? Perhaps you're including the header
twice in the same compilation unit. If so, you can fix that by putting the
following lines (or something similar) around the contents of your header
file:

#ifndef h_myclass
#define h_myclass

// rest of header file contents here...

#endif


-Howard




Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.