package name conflicts with keyword...

Thomas Léauté thleaute@csail.mit.edu
Fri Sep 3 14:27:00 GMT 2004


Le Sep 3, 2004, à 10:11 AM, Andrew Haley a écrit :

> Thomas Léauté writes:
>>
>> Le Sep 3, 2004, à 5:17 AM, Andrew Haley a écrit :
>>
>>> Thomas Léauté writes:
>>>> Hi
>>>>
>>>> I am confronted with bug #14875, and I am trying to go around
>>>> it, but I am not familiar enough with java, so I need
>>>> help...  Basically, I have been provided with some java code
>>>> that I am trying to interact with from C++. This java code uses
>>>> a package that has the very unfortunate characteristic to be
>>>> called "or". Yes, just like the C++ keyword...
>>>
>>> I thought this was optional with "-foperator-names".
>>>
>>
>> Where does that option come in? I have tried to pass it both to gcj 
>> and
>> to gcjh but I get the following errors:
>
> "or" is only a keyword in C++, so you only have to use this option
> when compiling your C++ code.

The only C++ code I have is main.cpp, containing a simple main() 
function. If I use the "-foperator-names" option to compile this file, 
I get that:

> g++-3.4  -c -foperator-names main.cpp -I.
> In file included from main.cpp:18:
> BlueNode.h:19: error: expected identifier before '||' token

BlueNode.h is the header file generated by gcjh. Here are lines 17 to 
26:

>   namespace drasys
>   {
>     namespace or
>     {
>       namespace matrix
>       {
>         class VectorI;
>       }
>     }
>   }

You can see it is still complaining about the namespace called "or" 
(corresponding to the java package called "or").

Thomas

" We know what we think we know,
    Just as we don't know what we want to know "
                         Oscar Wilde
                         The Picture of Dorian Gray



More information about the Java mailing list