<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>I have been really struggling on this one.
</FONT></DIV>
<DIV><FONT face=Arial size=2>I've defined a module in my IDL interface,
generated C++ code with omniIDL, and for some reason am unable to take advantage
of the C++ "using namespace" directive - thus I need to specify the actual
namespace *everywhere* in my application code. Why the heck doesn't "using
namespace" help disambiguate types in the generated classes?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Here is my simple IDL interface:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>module oreillyTest {</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> interface ServerTest {</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> enum Status
{<BR> Ok, Failed<BR>
};</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> void
ping();</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> short foo(out float
x);</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> };<BR>};</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I compile the IDL to C++ with the
following:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>omniidl -bcxx -Wbh=.h -Wbs=_SK.cc
ServerTest.idl</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Now here is a simple implementation of the IDL
interface:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>#include "ServerTest.h"</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV><FONT face=Arial size=2>
<DIV><BR><FONT face="Courier New">class BasicServer : virtual public
POA_test::ServerTest {</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New"> public:</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New"> BasicServer(oreillyTest::ServerTest::Status
status);</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New"> virtual void ping();</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><BR><FONT face="Courier New"> oreillyTest::ServerTest::Status
_status;</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New">};</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New">using namespace
oreillyTest; // Don't want to use namespace
everywhere</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New">BasicServer::BasicServer(ServerTest::Status
status) { // COMPILER ERROR HERE!!!<BR> _status =
status;<BR>}<BR></FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>For some reason, gcc (v 4.0.0) cannot successfully compile this,
giving:</DIV>
<DIV> BasicServer.cc:5: error: expected `)' before 'status'</DIV>
<DIV> </DIV>
<DIV>I.e. I must prepend the namespace "oreillyTest::" before every occurrence
of ServerTest::Status - even though I've specified "using namespace oreillyTest"
- does anyone know why?</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Tom</DIV>
<DIV> </DIV>
<DIV> </DIV></FONT></FONT></DIV>
<DIV><FONT face=Arial
size=2>--------------------------------------------------<BR>Thomas C.
O'Reilly<BR>Monterey Bay Aquarium Research Institute<BR>7700 Sandholdt
Road<BR>Moss Landing, California 95039-9644<BR>831-775-1766
(voice)<BR>831-775-1620 (FAX)<BR><A
href="mailto:oreilly@mbari.org">oreilly@mbari.org</A> (email)<BR><A
href="http://www.mbari.org">http://www.mbari.org</A> (World-wide
Web)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>"The machine does not isolate man from the great
mysteries<BR> of nature, but plunges him more deeply into
them."</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> - ANTOINE DE
SAINT-EXUPERY<BR> "Wind, Sand, and Stars"
(1939)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>