On 6/8/2015 11:26 AM,
kennetha...@gmail.com wrote:
> On Monday, June 8, 2015 at 11:02:57 AM UTC-4,
kennetha...@gmail.com wrote:
>> So, I've been programming for a while, deriving some c++ classes
>> from
protobuf. All of a sudden, after a weekend, I do a make clean and then a
make again, and I have conflicting references. I have no idea what could
have happened, environment or otherwise that could make this issue show
up, because the whole time that I've been compiling and successfully
using my protobuf data schema's they've not barfed on this issue.
>>
>>
>> Essentially, in one of the protobuf data schema specs, I have a
member called "plus". It now blows up with:
>>
>>
>> In file included from SerializerInterface.h:37:0,
>> from SomeClass.cpp:12:
>> Schema.pb.h:115:35: error: reference to 'plus' is ambiguous
>> const binop_type binop_type_MIN = plus;
Is 'SerializeInterface.h' yours or a third-party's?
>> .....
>>
>> /usr/include/c++/4.8/bits/stl_function.h:140:12: note: template<class _Tp> struct std::plus
>> struct plus : public binary_function<_Tp, _Tp, _Tp>
>>
>>
>> I checked, and I don't have any kind of "using namespace std;" anywhere.
You don't. What about the library you're using? Not all library
vendors/designers are diligent about not putting 'using' directives in
the headers...
>>
>> I understand what the issue is, but I don't know why it showed up,
and I'm looking for a resolution where I don't have to edit my schema.
I'm not supposed to edit the schema because that's the same across a lot
of different files. I know that that schema can be made to work as well,
because it worked before.
>>
>> How can I edit either SomeClass.cpp or SerializerInterface.h to no
longer conflict with plus? I can't prevent stl_function.h from being
included-a library I have no power over includes it.
>
> Actually, would there be a way that I could place a using statement
> just above my #include where the generated file has the issue in
> order that the compiler would be able to subsequently differentiate?
Not sure what exactly you're asking. Can you edit your own files? Can
you type "using namespace blah;" in it? Can you do that before the
first #include directive in that file? What is it you'd like us to tell
you? "Just do it"?
Seriously though, why don't you try doing what you think is needed? If
you think that you can learn more with a 'using' directive, add one and
see if you're correct.
> I'd just like to either allow the compiler to know that by plus I
> mean the plus I defined, or just to rename the plus defined in that
> header so that it's no longer visible at all.
You can always name your own plus to something else for starters...
V
--
I do not respond to top-posted replies, please don't ask