Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Conflicting names
Conflicting names [message #146434] Thu, 02 June 2005 09:01 Go to next message
Eclipse UserFriend
Originally posted by: bluesboys.-remove-this-hotmail.com

Hi Group

I'm using namespaces in my project, and have the following two classes

namespace A
class foo //Interface

namespace A
namespace B
class foo //Implementation

The compilation runs without problems, but Eclipse shows an error under
problems, that I have conflicting names. Is there somewhere I can tell
Eclipse that it is ok, or shut down this check?

Best Regards
S
Re: Conflicting names [message #146521 is a reply to message #146434] Sun, 05 June 2005 05:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: emiliano.lesende.gmail.com

Hansen wrote:
> Hi Group
>
> I'm using namespaces in my project, and have the following two classes
>
> namespace A
> class foo //Interface
>
> namespace A
> namespace B
> class foo //Implementation
>
> The compilation runs without problems, but Eclipse shows an error under
> problems, that I have conflicting names. Is there somewhere I can tell
> Eclipse that it is ok, or shut down this check?
>
> Best Regards
> Søren Hansen
>
>
>

It might be a problem with the parser. If you can please post the source
code that causes the problem.

Regards
Emiliano
Re: Conflicting names [message #146534 is a reply to message #146521] Mon, 06 June 2005 06:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bluesboys.-remove-this-hotmail.com

"Emiliano Lesende" <emiliano.lesende@gmail.com> wrote in message
news:d7u1p9$6ar$2@news.eclipse.org...
> Hansen wrote:
>> Hi Group
>>
>> I'm using namespaces in my project, and have the following two classes
>>
>> namespace A
>> class foo //Interface
>>
>> namespace A
>> namespace B
>> class foo //Implementation
>>
>> The compilation runs without problems, but Eclipse shows an error under
>> problems, that I have conflicting names. Is there somewhere I can tell
>> Eclipse that it is ok, or shut down this check?
>>
>> Best Regards
>> S
Re: Conflicting names [message #146541 is a reply to message #146534] Mon, 06 June 2005 16:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: simon.ou.edu

Hi Hansen...

Hansen wrote:
> "Emiliano Lesende" <emiliano.lesende@gmail.com> wrote in message
> news:d7u1p9$6ar$2@news.eclipse.org...
>
>
> <<tramsportLayerInterface.hpp>>
>
> namespace communicationlayer
> {
> class TransportLayer
> {
> public:
> TransportLayer() {};
> ... (a number of virtual functions)
> }
>
> <<transportLayer.hpp>>
> #include "TransportLayerInterface.hpp"
>
>

you are defining 'communicationlayer' namespace twice (above and below).
This is not allowed. Do you mean that you want to use the namespace
inside the new defined name space?

One possibility that you may want to consider the following... design
your classes with no name space. Just write normal code when defining
your classes and such. Now, when you implement them, then use namespaces.

namespace rs232
{
TransportLayer *tL = new TransportLayer();
}

main()
{

rs232::tL->init();

{ // -----------------------------
using namespace rs232

tL->yourCodeFunction();

} // -----------------------------
}

and in this way you keep zero namespace corruption, which may be your
intended result after all.

Regards...

Miguel.


>
> namespace communicationlayer
> {
> namespace rs232
> {
> class TransportLayer : public communicationlayer::TransportLayer
> {
> public:
> TransportLayer(unsigned short comPort);
> ... (implementation of the virtual functions in transportLayerInterface.hpp)
> }
>
> Best Regards
> Søren Hansen
>
>
Re: Conflicting names [message #146629 is a reply to message #146534] Wed, 08 June 2005 19:13 Go to previous messageGo to next message
Andrew Niefer is currently offline Andrew NieferFriend
Messages: 990
Registered: July 2009
Senior Member
Assuming the missing closing braces in transportLayerInterface.hpp is just a
typo, the idea is ok. Namespaces are allowed to be have their definitions
split up like that and both communicationlayers are the same namespace.

The problem marker is likely a bug with the parser. I don't know what
version of CDT you are using, but in the latest from cvs (soon to be CDT
3.0M7) I don't get a problem marker with this pattern.

-Andrew

"Hansen" <bluesboys@-remove-this-hotmail.com> wrote in message
news:d80q6t$juc$1@news.eclipse.org...
>
> <<tramsportLayerInterface.hpp>>
>
> namespace communicationlayer
> {
> class TransportLayer
> {
> public:
> TransportLayer() {};
> ... (a number of virtual functions)
> }
>
> <<transportLayer.hpp>>
> #include "TransportLayerInterface.hpp"
>
>
>
> namespace communicationlayer
> {
> namespace rs232
> {
> class TransportLayer : public communicationlayer::TransportLayer
> {
> public:
> TransportLayer(unsigned short comPort);
> ... (implementation of the virtual functions in
transportLayerInterface.hpp)
> }
>
> Best Regards
> S
Re: Conflicting names [message #146660 is a reply to message #146629] Thu, 09 June 2005 05:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: simon.ou.edu

Hi Andrew...

Yes, you are right. Splitting namespace definitions does compile/work
alright (any simple example can show this). Thank you for making this
point clear.

Regards...

Miguel

Andrew Niefer wrote:
> Assuming the missing closing braces in transportLayerInterface.hpp is just a
> typo, the idea is ok. Namespaces are allowed to be have their definitions
> split up like that and both communicationlayers are the same namespace.
>
> The problem marker is likely a bug with the parser. I don't know what
> version of CDT you are using, but in the latest from cvs (soon to be CDT
> 3.0M7) I don't get a problem marker with this pattern.
>
> -Andrew
>
Re: Conflicting names [message #146666 is a reply to message #146629] Thu, 09 June 2005 06:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bluesboys.-remove-this-hotmail.com

"Andrew Niefer" <aniefer@ca.ibm.com> wrote in message
news:d87fpv$rn3$1@news.eclipse.org...
> Assuming the missing closing braces in transportLayerInterface.hpp is just
> a
> typo, the idea is ok. Namespaces are allowed to be have their
> definitions
> split up like that and both communicationlayers are the same namespace.
>
> The problem marker is likely a bug with the parser. I don't know what
> version of CDT you are using, but in the latest from cvs (soon to be CDT
> 3.0M7) I don't get a problem marker with this pattern.

I use the 3.1M6

-S
Re: Conflicting names [message #146978 is a reply to message #146666] Wed, 15 June 2005 17:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: devin_steffler.ca.ibm.com

3.1M6 must be the version of Eclipse that you are using. Do you know what
version of CDT you are using?

Devin

"Hansen" <bluesboys@-remove-this-hotmail.com> wrote in message
news:d88obd$2eb$1@news.eclipse.org...
>
> "Andrew Niefer" <aniefer@ca.ibm.com> wrote in message
> news:d87fpv$rn3$1@news.eclipse.org...
> > Assuming the missing closing braces in transportLayerInterface.hpp is
just
> > a
> > typo, the idea is ok. Namespaces are allowed to be have their
> > definitions
> > split up like that and both communicationlayers are the same namespace.
> >
> > The problem marker is likely a bug with the parser. I don't know what
> > version of CDT you are using, but in the latest from cvs (soon to be CDT
> > 3.0M7) I don't get a problem marker with this pattern.
>
> I use the 3.1M6
>
> -S
Re: Conflicting names [message #146984 is a reply to message #146978] Mon, 20 June 2005 14:18 Go to previous message
Eclipse UserFriend
Originally posted by: bluesboys.-remove-this-hotmail.com

"Devin Steffler" <devin_steffler@ca.ibm.com> wrote in message
news:d96fsj$92p$5@news.eclipse.org...
> 3.1M6 must be the version of Eclipse that you are using. Do you know what
> version of CDT you are using?
>
> Devin

It is correct, I
Previous Topic:matching brace/bracket in C++ editor
Next Topic:Managed Make vs Makefile
Goto Forum:
  


Current Time: Sat Jul 13 19:14:32 GMT 2024

Powered by FUDForum. Page generated in 0.04459 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top